Passing query parameter form values to a report

S

Soriah

Since I’m a newbie at creating databases, I’m at a loss at getting my form to
open a report instead of opening the actual query table. I found several
sites in Help that gave me some useful hints; however, I couldn’t find one
specific to my problem.

You see, I created a simple, single combo-box query parameter form, without
‘OK’ or ‘Cancel’ buttons, that I would like to pass values to a report.
However, when I open the report, the query table opens instead of that
information being passed to the report. I found a site that says the
following code should be placed in the ‘After Update’ field in the form’s
combo box properties:

Private Sub cboOffice_AfterUpdate()
DoCmd.OpenQuery "qryQueryName", acViewNormal, acEdit
DoCmd.Close acForm, "frmFormName"
End Sub

I also placed the following code inside the report’s Open:

Private Sub Report_Close()
DoCmd.Close acForm, "frmFormName"
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 Form
DoCmd.OpenForm "frmFormName", , , , , acDialog

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

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

I’m guessing the problem lies in the last two statements in this code (?).

Is there a way to do this without ‘OK’ and ‘Cancel’ buttons?

Thanks in advance for your help,
Soriah
 

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