Mar 17, 2006 #1 rawii IS-IT--Management Oct 16, 2002 15 US How do I pass a value to a VBA Sql statement for the where clause?
Mar 17, 2006 #2 PHV MIS Nov 8, 2002 53,708 FR 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 Upvote 0 Downvote
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
Mar 17, 2006 #3 Zion7 IS-IT--Management May 2, 2003 1,276 CA 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 & "'" Upvote 0 Downvote
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 & "'"