Controlling ODBC queries with VB variables

  • Thread starter Thread starter vehement
  • Start date Start date
V

vehement

The correct way to pass a variable is like this:

"WHERE (`ORDER PROJECTIONS`.LB4= ' " & Var & " ')"

Notice the double qoutes nested within the single qoutes. VB think
your ending the query string otherwise. Thanks again Eric.

This is a good site for writing queries in Office VBA
http://www.fontstuff.com/access/acctut15.ht
 
Careful if the backend database is DB2 and the data field is numeric those
single quotes are going to cause a type mismatch error.

Mark
 

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

Similar Threads


Back
Top