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

how to open a report based upon user defined criteria

Status
Not open for further replies.

pthakar

Programmer
Feb 28, 2003
38
US
I have a report rptbldg for all buildings detail and multiple leases.
I also have a form Fmpass for passing the parameters. On this form I have combox for sub market and class for the building where user can select a building sumarket and class.
What i need to do is have a submit button and by clicking that button, based upon the criteria specified the report preview would be displayed.
Is it possible if yes then how????
Pl. help me
Thanks
 
What you will need to do is base your report on a query that gets the criteria from a form. This is known as Query By Form (QBF).

Check the following link for more information on QBF:



The click event of your from would then need to open your report in print preview mode.

The code for the button's click event will look something like this:

Private Sub cmd_PreviewMyReport_Click()
On Error GoTo Err_cmd_PreviewMyReport_Click

Dim stDocName As String

stDocName = "rpt:MyReport"
DoCmd.OpenReport stDocName, acPreview
DoCmd.Maximize


Exit_cmd_PreviewMyReport_Click:
Exit Sub

Err_cmd_PreviewMyReport_Click:
MsgBox Err.Description
Resume Exit_cmd_PreviewMyReport_Click
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top