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

Use macro to set value for queries

Status
Not open for further replies.

melaniecarr23

Programmer
May 2, 2005
79
US
I have a macro which calls several queries, all based on the same piece of information.

Is there a way to ask the user for the information and use it as criteria in each of the queries used after that in the macro?

Thanks!
 
Are you currently using a prompt to get the user information in each query? Use a form instead and then just reference that control name in all the queries.

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
Can you give me an idea of how to do this? I've not gotten it to work before so I was trying this instead.
 
This is generally how you do it (i don't do any designing in Access)

Create a new form, "SearchForm". Put a text box on it. Name it something meaningful "SearchCriteria".

Now in ALL the queries put this:

WHERE PieceOfInformation = Forms.SearchForm.SearchCriteria

(you may need ! instead of ., I'm not real sure)

put a button on the form. Call your macro from the button.

enter information in the text box and press the button.



Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top