Basic query criteria

dcarr

Trainee Database Analyst
Local time
Today, 23:04
Joined
Jun 19, 2002
Messages
112
I am attempting to build a query based on a selection/range of data.
The values I wish to search for are >=L300 AND <=L499, >=P300 AND <=P499, >=S300 AND <=S499, >=W300 AND <=W499.

How would I construct the criteria to include all of the data?

Thanks
 
Using between...and... produces faster results than >= and <=.

((([YourField]) Between L300 AND L499) OR (([YourField) Between P300 AND P499) OR (([YourField]) Between S300 AND S499) OR (([YourField]) Between W300 AND W499))
 
Last edited:
Thanks. If I were to copy and paster the syntax you provided me with do I need to enter the name of my field Per_Source_Sent into the [] parentheses or can I cut them out and will the query pick up from the field the syntax has been entered? e.g ((([Per_Source_Sentine]) Between L300 AND L499) OR (([Per_Source_Sentine) Between P300 AND P499) OR (([Per_Source_Sentine]) Between S300 AND S499) OR (([Per_Source_Sentine]) Between W300 AND <=W499))

Thanks
 
If you just use the QBE grid to build the query...there are a number of lines for criteria for each field.

Just put the four between...and statements under each other and the SQL will be built for you.

P.S. I edited my last post.
 
So typically I would specify in the qbe:

Between "L300" AND "L499" or
Between "P300" AND "P499" or
Between "S300" AND "S499" or
Between "W300" AND "W499"

Thanks, sorry I am a rather inexperienced but keen Acces user
 
In the grid you can remove the OR - it'll do it for you.
 
Cheers that worked a treat! Another valuable lesson learnt. Many thanks
 

Users who are viewing this thread

Back
Top Bottom