Focus Question

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.
 
G

Guest

When you say a "pop up form opens", have you set the properties of the form
to "pop-up", my understanding is that if you do this the form will always
stay on the top i.e. with the focus, try changing the properties of "pop-up"
back to 'No' and see if this helps.
 
G

Guest

Thank you for the quick response but I set the Pop Up property back to No and
I still have the same issues. The focus stays on the calendar form with the
report in the background but I cannot view it unless I close the calendar
form which removes the needed date information.
 

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