Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Access to Excel combining criteria

Using xl2000, Access 2000 with ADO query
The first 2 sql statements work, but I cant seem to get the syntax to
combine them as in #3 below.
Any help?
thanks

sql = "Select " & sFields & _
" From " & sTable & _
" WHERE (((DOB) = #1/1/90#))"

sql = "Select " & sFields & _
" From " & sTable & _
" WHERE (((Lname)Like""B%""))"

sql = "Select " & sFields & _
" From " & sTable & _
" WHERE (((DOB) = #1/1/90#), ((Lname)Like""B%""))"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Access to Excel combining criteria

instead of a comma, try AND
eg.
select * from table where DOB = 1-Jan-1990 AND lname like 'B%'


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gocush" /delete wrote in message
...
Using xl2000, Access 2000 with ADO query
The first 2 sql statements work, but I cant seem to get the syntax to
combine them as in #3 below.
Any help?
thanks

sql = "Select " & sFields & _
" From " & sTable & _
" WHERE (((DOB) = #1/1/90#))"

sql = "Select " & sFields & _
" From " & sTable & _
" WHERE (((Lname)Like""B%""))"

sql = "Select " & sFields & _
" From " & sTable & _
" WHERE (((DOB) = #1/1/90#), ((Lname)Like""B%""))"



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Access to Excel combining criteria

Thanks That works

"Rob van Gelder" wrote:

instead of a comma, try AND
eg.
select * from table where DOB = 1-Jan-1990 AND lname like 'B%'


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gocush" /delete wrote in message
...
Using xl2000, Access 2000 with ADO query
The first 2 sql statements work, but I cant seem to get the syntax to
combine them as in #3 below.
Any help?
thanks

sql = "Select " & sFields & _
" From " & sTable & _
" WHERE (((DOB) = #1/1/90#))"

sql = "Select " & sFields & _
" From " & sTable & _
" WHERE (((Lname)Like""B%""))"

sql = "Select " & sFields & _
" From " & sTable & _
" WHERE (((DOB) = #1/1/90#), ((Lname)Like""B%""))"




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
Combining COUNTIF Criteria KMC Excel Discussion (Misc queries) 4 July 18th 08 04:40 PM
Applying Criteria in Excel Cell to MS Query Pull from Access Tony Excel Discussion (Misc queries) 1 February 1st 08 04:43 PM
export access to excel. change access & update excel at same time fastcar Excel Discussion (Misc queries) 0 June 24th 05 09:27 PM
Getting Access Error Messages when running Access through Excel Dkline[_2_] Excel Programming 0 October 12th 04 09:35 PM
Using InputBox to change query criteria in Access JohnBoy Excel Programming 2 September 16th 03 02:08 PM


All times are GMT +1. The time now is 11:37 AM.

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

About Us

"It's about Microsoft Excel"