Priting a report based on WHERE condition in the form (1 Viewer)

josephbupe

Registered User.
Local time
Today, 20:06
Joined
Jan 31, 2008
Messages
247
Hi,

I have WHERE condition declared under a Search button for programmatically searching a table through multiple input controls on a form.


I would like to know how i can open a filtered report based on the same
Code:
strWhere
condition.

Under a CmdPrint button I tried
Code:
DoCmd.OpenReport "R_EVENTS", acPreview, , strWhere
but this gives an
error Variable not defined
, referring to


Any tips will be appreciated.
 

josephbupe

Registered User.
Local time
Today, 20:06
Joined
Jan 31, 2008
Messages
247
Okay, I will check it out.


Thanx
 

bastanu

AWF VIP
Local time
Today, 10:06
Joined
Apr 13, 2010
Messages
1,402
Joseph,

Move the strWhere declaration from inside the sub where you do the search to the top of the form module if on the same form.

Cheers,
Vlad
 

josephbupe

Registered User.
Local time
Today, 20:06
Joined
Jan 31, 2008
Messages
247
Joseph,

Move the strWhere declaration from inside the sub where you do the search to the top of the form module if on the same form.

Cheers,
Vlad




Hi bastanu,


I appreciate that. Thanks
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:06
Joined
Feb 19, 2002
Messages
43,226
The strWhere variable must be populated with a proper condition. For example.

strWhere = "SomeField = " & Me.Somefield & " AND SomeOtherField = " & Me.SomeOtherField
 

Users who are viewing this thread

Top Bottom