I am trying to open a Dialog Form that populates a Report. I open the Report to start the Dialog Form. The problem I have is the Dialog Form opens then the report comes up before the dialog form can be can be filled out. I have the code in the report “open event”.
This is the Code I am using.
Private Sub Report_Open(Cancel As Integer)
' Open frmSelection form.
' IsLoaded function (defined in Utility Functions module) determines
' if specified form is open.
Dim strDocName As String
strDocName = "frmSelection"
' Set public variable to True so frmSelection Dialog knows that report
' is in its Open event.
blnOpening = True
' Open form.
DoCmd.OpenForm strDocName, , , , , acForm
' If Sales by frmSelection form isn't loaded, don't preview or print report.
' (User clicked Cancel button on form.)
If IsLoaded(strDocName) = False Then Cancel = True
'Set public variable to False, signifying that Open event is finished.
blnOpening = False
End Sub