PLease Help With Syntax

Evagrius

Registered User.
Local time
Today, 11:32
Joined
Jul 10, 2010
Messages
170
Hi all,

I know I must have the syntax wrong. Also, I am trying to filter a form with a query as the record source. The second filter criteria I have, "Asset Type", is not on field on the form, only in the Query. I am not sure if I have to have the actual field on the form in order to filtery by that field. Thank you for any help.


Code:
Me.Filter = "[Asset Owner]=John Smith" And "[Asset Type] = High Risk"
 Me.FilterOn = True
 Me.OrderByOn = True
 
Try ...
Code:
Me.Filter = "[Asset Owner] = 'John Smith' And [Asset Type] = 'High Risk'"
 
Hi Lagbolt - I am not sure why this is not working. But when I run the code I get a blank form. I filtered the query manually and it works - but when I use the code in the form I get nothing. Can you please advice? Thank You!
 
If you've filtered the query manually then open that correctly filtered query in SQL view and copy the filter text, essentially the WHERE clause. See if that works.
 
Thank You Lagbolt - it seems to be working now. Thank you for your help and attention. I played around with the properties of the form, and now it works - though I am not sure what I did. Is there a specific property of the form that stops it from being filtered other than "allow filters"?

Thanks Again!
 
Yeah, there's a FilterOn property you can set to false. Also, maybe you can just set the filter to "". Glad it's working.
 

Users who are viewing this thread

Back
Top Bottom