G
Guest
I have created a macro that opens a pop up form with two calendar controls on
it for beginning date and ending date. I also have a report based on a query
that uses the dates selected on these calendars as a date range.
What I want to happen is this: The user clicks on a button to start the
macro, the pop up form opens, the user chooses the beginning and ending date
and, upon selecting the ending date, the report using these dates opens.
I am close. The code below is on the ending date calendar control on the
pop up form and, when the macro is run, brings up the pop up calendar form.
I select the beginning date and the ending date, the report opens (I can see
it listed on the task bar) but the focus stays on the pop up form and you
can't view the report. When I close the pop up form the criteria for the
query is gone. I have tried this in all the form options (On Update, On
Enter, On Get Focus, etc.)
Private Sub Calendar2_Enter()
On Error GoTo Err_Calendar2_Enter
Dim stDocName As String
stDocName = "rptPoster1st"
DoCmd.OpenReport stDocName, acPreview
Exit_Calendar2_Enter:
Exit Sub
Err_Calendar2_Enter:
MsgBox Err.Description
Resume Exit_Calendar2_Enter
End Sub
Hope this makes sense. Any suggestions would be greatly appreciated.
it for beginning date and ending date. I also have a report based on a query
that uses the dates selected on these calendars as a date range.
What I want to happen is this: The user clicks on a button to start the
macro, the pop up form opens, the user chooses the beginning and ending date
and, upon selecting the ending date, the report using these dates opens.
I am close. The code below is on the ending date calendar control on the
pop up form and, when the macro is run, brings up the pop up calendar form.
I select the beginning date and the ending date, the report opens (I can see
it listed on the task bar) but the focus stays on the pop up form and you
can't view the report. When I close the pop up form the criteria for the
query is gone. I have tried this in all the form options (On Update, On
Enter, On Get Focus, etc.)
Private Sub Calendar2_Enter()
On Error GoTo Err_Calendar2_Enter
Dim stDocName As String
stDocName = "rptPoster1st"
DoCmd.OpenReport stDocName, acPreview
Exit_Calendar2_Enter:
Exit Sub
Err_Calendar2_Enter:
MsgBox Err.Description
Resume Exit_Calendar2_Enter
End Sub
Hope this makes sense. Any suggestions would be greatly appreciated.