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!

Query - using an expression in criteria

Status
Not open for further replies.

PhoneTech2

Technical User
Aug 12, 2002
16
0
0
US

I have one query (called QryVMLimits ) where I allow the user to set a value called [minimum]

I have another query where I want to list only those items that equal to or exceed the [minimum]as found in the first query

In the criteria section of the field that holds the quanity I have entered:

=>query![QryVMLimits]![minimum]

I have tried using the table
=>table![VMLimits]![minimum]

I have tried using form
=>Forms![FrmVMLimits]![minimum]

No matter how I enter this, when I run the query for list of items I get a dialog box asking me to enter the informatin for [queryName]![minimum]

If I enter a number, the query runs ok.

What am I doing wrong?

Thank you.
 
Why are you running a query to get the minimum then another query based off of that. Why not just write your query to prompt for a minimum?

Example:

SELECT YourTable.VMLimit
FROM YourTable
WHERE (((YourTable.VMLimit)>=[Enter Minimum]));

This would prompt you for a minimum number

You could also pull the minimum from a form.textBox etc.

 
CaptainD,

I have set the minimum, but I am giving the end user a chance to change it. If the minimum I have set is acceptable to the end user, I don't want them to have to enter a value each time they run the report.

So my question is still how do write an expression to put a value in a criteria of a query?

Thank you
 
You said you had the user set the value called minimum.

"I have one query (called QryVMLimits ) where I allow the user to set a value called [minimum]"

but anyway, the value is pulled and the user I assume can see it either in a text box or ??

Just reference the text box or ?? whatever you're using to show the value to the user in the query.

On Form VMLimit you have a text box that shows the VMLimit "Minimum"

Write the Query like this:

SELECT YourTable.VMLimit
FROM YourTable
WHERE (((YourTable.VMLimit)>=[Forms]![FrmVMLimits].[TextBox].[Value]));

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top