ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Access to Excel combining criteria (https://www.excelbanter.com/excel-programming/321561-access-excel-combining-criteria.html)

gocush[_29_]

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%""))"

Rob van Gelder[_4_]

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%""))"




gocush[_29_]

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%""))"






All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com