Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open A Dialog Form from a Report

Status
Not open for further replies.

luccas

Technical User
Dec 21, 2000
30
US


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
 
I think you have it backwards. Open the form first, then through a command button open the report after the criteria is entered.....
 
I want to use one "Dialog Form" to do several "Reports". I thought it would work this way but I can't Get the "Dialog Form" to stop to fill it out. I can see it opening then the "Report" opens immediately I just need a way to stop it to fill it out. ---It does work your way but i need to make more Dialog Forms.
 
If you use acDialog, this will prevent the rest of the code from running until after the form is filled out.

DoCmd.OpenForm strDocName, , , , , acDialog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top