Filtering Via Command Buttons

the-m0th

Registered User.
Local time
Today, 17:50
Joined
Apr 14, 2015
Messages
51
Hi,

i'm trying to make a form to filter a table and open a data entry form with the filtered data ready for editing. i've got it working when filtering a 1 field but i'd like to filter the data by 3 fields and i can't get it right. the code i'm trying to use is

Code:
DoCmd.OpenForm "Main", , , "[Admin District]='Corby'" And "[AgeRange]='31 - 50'" And "[Gender]='Male'"

it works fine when just filtering one field like this:-

Code:
 DoCmd.OpenForm "Entry75+", , , "Ward='Beddington South'"

any light you guys can shed would be much appreciated
Wayne
 
"[Admin District]='Corby'" And "[AgeRange]='31 - 50'" And "[Gender]='Male'"

Remove the surplus quotes (in red)
 
awesome, thank you very much indeed! finding out the purpose of all these quotation marks is the thing i'm finding hardest when trying to learn VBA.
 

Users who are viewing this thread

Back
Top Bottom