View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MarkInSalemOR MarkInSalemOR is offline
external usenet poster
 
Posts: 3
Default Controlling ODBC queries with VB variables

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

"vehement" wrote:


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 thinks
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.htm


--
vehement
------------------------------------------------------------------------
vehement's Profile: http://www.excelforum.com/member.php...o&userid=15417
View this thread: http://www.excelforum.com/showthread...hreadid=270221