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

Report Created from Unbound Form

Status
Not open for further replies.

Ninabunny

Programmer
Jul 24, 2000
70
US
I have this unbound form which will create a report after the user selects the criteria. The criteria is taken from two different queries which are from two different tables. the report is not coming up with the correct information.
Am I not calling the query or not defining the criteria enough?
After defining the criterion I click OK or Cancel and OK should come up with a report. I know I am missing something dumb here.

Private Sub cmdOK_Click()
On Error GoTo Err_cmdOK_Click

Dim stDocName As String

stDocName = "rptMajor"
DoCmd.OpenReport stDocName, acPreview

Exit_cmdOK_Click:

Exit Sub

Err_cmdOK_Click:
MsgBox Err.Description
Resume Exit_cmdOK_Click

End Sub


Nina
 
All this code does is open the report for preview, no where do I see it pass criteria to the report. Unless on the reports source it refers back to the fields you mention on the form. If you want to pass the criteria via this code then look up openreport action under help

It should look more like
DoCmd.OpenReport stDocName, acPreview,,"Your criteria here"
Good Luck

 
That would be what I am missing I believe...thank you muchly! Will try that out....
Nina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top