Passing a parameter to a Query

D

dhstein

I'm trying to understand how to code a query in VB and pass a parameter that
the user enters. I have the Query defined with a hard coded value and can
see the SQL statement in SQL view. I also have a text box which gives me a
variable strInput. So in the sub routine, what would I need to call the
"Select" statement and then can I just substitute the variable strInput where
the hard-coded value is ? Thanks for any help and don't eat too much turkey.
 
T

Tom van Stiphout

On Thu, 27 Nov 2008 12:12:00 -0800, dhstein

One option is in the query to replace the hardcoded value with:
Forms!YourForm!YourTextbox

-Tom.
Microsoft Access MVP
 
T

Tom Wickerath

Here are some samples that you can check out:

Easiest (minimal VBA code):
http://www.accessmvp.com/TWickerath/downloads/customdialogbox.zip

Demonstrates use of multi-select list box:
http://www.accessmvp.com/TWickerath/downloads/elements.zip

http://www.accessmvp.com/TWickerath/downloads/Chap08QBF.zip

http://www.seattleaccess.org/downloads.htm (see the Feb. 12, 2008 download)


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

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