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

open a criteria based Report from a form, How to?

Status
Not open for further replies.

bjayhome

Technical User
Dec 13, 2001
17
0
0
US
Hi All,

I want to use a Form to get parameter values (criteria’s) from the user for a Query, and then use these values to open a Report, which has its ‘recordsource’ set to the earlier mentioned query.
Could anyone help me? I want to do it through VB code. Thank you in advance for your help.

Bjay
 
You can actually do it in the query by saying =Forms![<formname>]![<fieldname>].

To do it in VB, use DoCmd.OpenReport with the wherecondition argument. Less practical alternatives are to set the report's Filter and FilterOn properties or to retype the RecordSource property.
 
Thanks TrojanRabbit!
I was so cought up in doing it through code, just overlooked the simplest way.
It's working fine now, I assigned the criteria in the Query itself.
bj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top