Hello,
I want to generate reports between two dates. So i am using two DTPicker to select StartDate and EndDate. So I have written some code for it. But it is not working.

Private Sub cmdgenerate_Click()
Dim X As Variant
Dim Y As Variant
X = DTPickerstartdate.Value
Y = DTPickerenddate.Value

startdate = DateValue(DTPickerstartdate.Value)
enddate = DateValue(DTPickerenddate.Value)
   DTPickerstartdate.Value = str(startdate)
   DTPickerenddate.Value = str(enddate)
    var = (enddate - startdate)
    If var < 1 Then
        MsgBox "Choose proper dates", vbExclamation
    Else

DataEnvironment1.rptrenewal X, Y
rpt_renewal.Show
Unload DataEnvironment1
End If
Exit Sub
End Sub

I an having an error in DataEnvironment1.rptrenewal X, Y, as Wrong number of argument invalid property assignment. Please help me out.....

Thank you very much.. for helping me out..
But there is another problem for me.. How can i generate reports between specific dates? I am using two DTPicker's.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.