Passing Parameter from a Form to a Query

G

Guest

I have a query, qryBudgetTotals, that requires a parameter, BudgetAmount. When I run the query by itself, it prompts me for the Parameter, then runs fine. I wish to use a form now to call the query. I am using a text box on the form, txtBudgetAmount, to prompt the user for the parameter. But now I can’t figure out how to get the txtBudgetAmount to the query. How to I call the query using the form and pass the parameter? I can’t seem to figure this one out

I tried loading the query as the recordset in the form parameter, and that failed. I also tried coping the complete sql statement into VB, then doing a recordset = form, sql statement, but that is failing also. I realize there is probably an easy way to do this, but I haven’t been able to figure it out

I am new to Access and appreciate your help

Thanks
Mik
 
A

Arvin Meyer

In the criteria box of the query column used as a parameter enter:

[Forms]![YourFormName]![txtBudgetAmount]
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Mike P said:
I have a query, qryBudgetTotals, that requires a parameter, BudgetAmount.
When I run the query by itself, it prompts me for the Parameter, then runs
fine. I wish to use a form now to call the query. I am using a text box
on the form, txtBudgetAmount, to prompt the user for the parameter. But now
I can't figure out how to get the txtBudgetAmount to the query. How to I
call the query using the form and pass the parameter? I can't seem to
figure this one out.
I tried loading the query as the recordset in the form parameter, and that
failed. I also tried coping the complete sql statement into VB, then doing
a recordset = form, sql statement, but that is failing also. I realize
there is probably an easy way to do this, but I haven't been able to figure
it out.
 
G

Guest

Arvin

In the criteria box of the query column I have a >=(Select (Sum(blah, blah, blah)) statement
Is there somewhere else I can place the [Forms]![YourFormName]![txtBudgetAmount]

fyi..., The Parameter [Budget] is in the Field colum

Mik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top