LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA ADO SQL Query Problem


Hi all,

Long winded title for this one!

Got another problem with my SQL Query after connecting from VBA Excel
via ADO to MS Access. I'm hoping someone in here might have an
incling...


Code:
--------------------

.Open "SELECT [Date], [Part No], [Batch Qty] FROM [" & TableName & "] " & _
" WHERE [" & TableName & "].[Date] LIKE '" & sDate & "'", cn, , , adCmdText

--------------------


sDate is declared as a date and the above statement performs as it
should, but i'm getting an error 'Data Type Mismatch in Criteria
Expression' when I change my statement from LIKE to =, example;


Code:
--------------------

.Open "SELECT [Date], [Part No], [Batch Qty] FROM [" & TableName & "] " & _
" WHERE [" & TableName & "].[Date] = '" & sDate & "'", cn, , , adCmdText

--------------------


I need to be able to perform a BETWEEN statement on the date and this
does not work either producing the same error message. Anyone have any
ideas why this is happening?

TIA....Any Ideas Appeciated!


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=529937

 
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
Query problem Keith H[_2_] Excel Discussion (Misc queries) 2 December 16th 09 04:30 PM
Ms Query problem Janie Excel Discussion (Misc queries) 2 September 19th 06 07:25 PM
Problem with MS Query - can't edit query jarems Excel Discussion (Misc queries) 2 December 12th 05 09:42 AM
Query problem Will Excel Discussion (Misc queries) 2 November 21st 05 03:02 PM
Problem with .Background Query option of ODBC Query Shilps Excel Programming 0 April 19th 04 06:41 AM


All times are GMT +1. The time now is 06:21 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"