Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Controlling ODBC queries with VB variables


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

--
vehemen
-----------------------------------------------------------------------
vehement's Profile: http://www.excelforum.com/member.php...fo&userid=1541
View this thread: http://www.excelforum.com/showthread.php?threadid=27022

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ODBC Passwords saving in Excel queries Brian Excel Discussion (Misc queries) 0 April 17th 09 10:10 PM
Parameters In External ODBC Data Queries - "is one of" Michael R Excel Discussion (Misc queries) 0 October 2nd 07 10:52 AM
Controlling ODBC queries with VB variables vehement[_2_] Excel Programming 0 October 19th 04 04:53 PM
Controlling ODBC queries with VB variables vehement Excel Programming 1 October 18th 04 10:56 PM
Column aliasing fails in ODBC queries w/multiple tables andrew strebkov Excel Programming 0 February 2nd 04 03:06 PM


All times are GMT +1. The time now is 09:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"