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

Where condition in DoCmd.Open Report

Status
Not open for further replies.

mrathi

Technical User
Oct 27, 2003
115
US
Thanks for any help. I have a query with a field name UnitID. I have a report based on that query and the report shows all the UnitID's one page after another. Now I have created another form with a list box, single selection. In the list box are all the UnitID's listed. I want to create a command button, so that a user can select a particular UnitID and print only report for that ID. Should be a piece of cake for experts like you :)

Thanks
 
Hi

Look in help for the syntax of DoCmd.OpenReport, you will see that it includes a where clause

in that parameter put "UnitId = " & cboBox

or if UnitId is a string

"UnitId = '" & cboBox & "'"

where cboBox is the name of your list box

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks , however, it still shows me all the units in the report. ??

 
It worked. Thanks a lot, I appreciate it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top