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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameters using forms and reports

Status
Not open for further replies.

EBOUGHEY

Programmer
Aug 20, 2002
143
0
0
US
I have set up a query and a form. When I run them independently, they run fine. (I used a sample setup from Access help). The report will not run properly though. It brings up the form, then asks for the parameters to be input as well. Please help!

Elena

I created a report that has an open/close event and the code looks like this:

Private Sub Report_Close()
DoCmd.Close acForm, "Follow Up Dialog"
End Sub

Private Sub Report_Open(Cancel As Integer)
' Set public variable to true to indicate that the report
' is in the Open event
bInReportOpenEvent = True

' Open Sales By Category Dialog
DoCmd.OpenForm "Follow Up Dialog", , , , , acDialog

' Cancel Report if User Clicked the Cancel Button
If IsLoaded("Follow Up Dialog") = False Then Cancel = True

' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub

Forms Look like this:

"Follow up Form":

Option Compare Database

Private Sub Cancel_Click()
DoCmd.Close 'Close Form
End Sub

Private Sub Category_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub Form_Load()

End Sub

Private Sub OK_Click()
Me.Visible = False
DoCmd.OpenReport "Follow Up", acViewNormal, acEdit
DoCmd.Close acForm, "Follow Up Form"
End Sub


"Follow Up Dialog":

Option Compare Database

Private Sub Cancel_Click()
DoCmd.Close
End Sub

Private Sub Form_Open(Cancel As Integer)
If Not bInReportOpenEvent Then
' If we're not called from the report
MsgBox "For use from the Follow Up Report only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub

Private Sub OK_Click()
Me.Visible = False
End Sub


 
My post is incorrect on the code. I changed it to openreport after reading an archive post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top