Passing a parameter to a Query

  • Thread starter Thread starter dhstein
  • Start date Start date
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.
 
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
 
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
__________________________________________
 
Back
Top