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

Passing value for sql where statement

Status
Not open for further replies.

rawii

IS-IT--Management
Oct 16, 2002
15
0
0
US
How do I pass a value to a VBA Sql statement for the where clause?
 
The short answer is:
by passing a value.
Any chance you could elaborate on what you want to do as my crystal ball is gone for the week-end now ;-)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I'd lend you mine PHV,
but it doesn't seem to be too reliable, either ...

rawaii, is it concatenation you're inquiring about?

I trust you've seen an SQL statement from the query pane,
SQL view?

What programmers often do, is cut & paste that statement,
onto the VBE window.

Now, this statement must be surrounded by Double quotes,
as all strings must.
Then you can concatenate a variable or textbox value.

"SELECT txtCountry, txtCity " & _
"txtLastName & ', ' & txtFirstName As Name " & _
"FROM tblPlaces " & _
"WHERE txtName ='" & Me.txtName & "'"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top