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

Running a Query from a form

Status
Not open for further replies.

pokeymonsc

Technical User
Jul 27, 2004
29
0
0
US
I have a query that uses an input from a form, the results being all people in a selected pay-grade. Since the field contains paygrade and step (04/05, 10/02, etc.)and I want all persons in paygrade 04 I use the following code:

Like [forms]![frmGradeSelect]![cboGradeBegin] & "*"
This works! When I run the query I select the paygrade (09) and get all 09's reguardless of what step they are.

Now the question: I'd like to be able to select a range of paygrades; say 09 to 12 and a query would normally use 'Between ... and', something like this:

Between Like [forms]![frmGradeSelect]![cboGradeBegin] & "*" And Like [forms]![frmGradeSelect]![cboGradeEnd] & "*"

The problem is that it won't run like this and I can't seem to find how to bracket the expression to make it work.
Something like:
Between [Like [form ......] & "*"] and [like .....].(Doesn't run like this or with ( or with{, etc.)\
is it possible to run like this in a query?

Anyone out there ever do something like this before???
 
I think you can take out the LIKEs (and asterix's) in this case, because it will know that, for example

04/18 is between 04 and 09
04/18 is not between 02 and 03

it will treat them alphanumerically. Try it out.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
So simple I didn't think of that. It worked, thanks for pointing it out. %-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top