Making "date range" work for reports

G

Guest

I want to insert a begin and end-date in a “pop-up†form to open up a report
for information generated between the two dates, such as quarterly reports. I
suspect that a single date field must be placed in the form indicating when
records were created.

I have the code for a form with two date fields, below, that pops-ups when
reports are opened, that prompts end-users to provide a, “date-rangeâ€.
However, how and where do you reference the date field for indicating the
date-range of the records you want to publish in a report? Right now, you can
insert any date, and the same information in the report opens up.

thanks,
John

Private Sub Form_Open(Cancel As Integer)
On Error GoTo ErrLine
Me.Caption = Me.OpenArgs
ExitLine:
Exit Sub
ErrLine:
Resume ExitLine
End Sub

Private Sub Preview_Click()
On Error GoTo ErrLine
If IsNull([Beginnining Registration Date]) Or IsNull([Ending Registration
Date]) Then
MsgBox "You must enter both beginning and ending dates."
DoCmd.GoToControl "Beginnining Registration Date"
Else
If [Beginnining Registration Date] > [Ending Registration Date] Then
MsgBox "Ending date must be greater than Beginning date."
DoCmd.GoToControl "Beginnining Registration Date"
Else
Me.VISIBLE = False
End If
End If
ExitLine:
Exit Sub
ErrLine:
Resume ExitLine
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top