Same criteria for two query fields (1 Viewer)

L

ljo1965

Guest
I have a table with alot of fields, there is three in particular that have me stumped.
they are 6amwatertemp, 9amwatertemp, 12pmwatertemp

I have set the query to ask for criteria for a few of the fields, what i want is for the query to ask for a between a temp and another temp and have the query apply the criteria to all three of these fields, without having to type it in three times. if the is any help you can give me i'd appreciate it

I also want to say that I have gotten countless help from reading other posts and want to say Thanks

ljo1965
 
J

Jerry Stoner

Guest
Make a form. Put a textbox, combobox(whatever) on it. Youll enter your criteria in this control. In all 3 fields you want the criteria to apply in your query put

[Forms]![YourFormName].[your control name]

ie:[Forms]![frmtrans].[txtSalesOrdNum]

That should do it.

HTH
 

Jon K

Registered User.
Local time
Today, 10:03
Joined
May 22, 2002
Messages
2,209
It is more user-friendly to use the form suggested by Jerry.

But if you want to use a query, you can declare the parameters above the SELECT statement in the query's SQL View e.g.

PARAMETERS [Start] Long, [End] Long;
SELECT *
FROM yourTable
WHERE [6amwatertemp] between [Start] and [End] AND [9amwatertemp] between [Start] and [End] AND [12pmwatertemp] between [Start] and [End];


When the query is run, the user is asked only once for the values of [Start] and [End].

The code assumes the temps are of data type Long. You can look up PARAMETERS declaration in Help for other data types.
 
Last edited:
L

ljo1965

Guest
I was able to get the form working, your right it does seem to be more user- friendly

Thank you for your help
 

Users who are viewing this thread

Top Bottom