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

Pass VB variable to query criteria? 1

Status
Not open for further replies.

dmon000

Technical User
Sep 9, 2003
79
US
How can you get a VB variable value as the criterion in a query?
 
In the criteria call a function that returns the variable.

 
You construct a string in which the query you want to pass to SQL/Access like this

command = "insert into village_facilities values ('" & mdate & "','" & x2 & "','" & x3 & "','" & x4 & "')"

where x1, x2 are values to be passed
'" & varname & "' will pass a non numeric value where as
" & varname & " will pass a numeric value

to execute the query use
conn.execute command
where conn has to be defined to the database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top