G
gatarossi
Dear all,
I'm trying to do a sql instruction to bring data from access, but I don
´t know why it doesn't work:
Dim xlsht3 As Excel.Worksheet
Dim crit_customer As String
Set xlsht3 = Sheets("by model")
If xlsht3.Cells(3, 5).Value = "1-ALL CUSTOMERS" Then
crit_customer = "*"
Else
crit_customer = xlsht3.Cells(3, 5)
End If
sql = "SELECT ........ "
sql = sql & "WHERE (Left([yyyymm],4))= '2007' "
sql = sql & "AND cad_buyer_bill.buyer_name_bill Like '" &
crit_customer & "' "
When I put any customer name, it works, but when I have "1-ALL
CUSTOMERS" it doesn´t work!!!!
What can I do to solve this problem????
Thanks in advance!!!!
I'm trying to do a sql instruction to bring data from access, but I don
´t know why it doesn't work:
Dim xlsht3 As Excel.Worksheet
Dim crit_customer As String
Set xlsht3 = Sheets("by model")
If xlsht3.Cells(3, 5).Value = "1-ALL CUSTOMERS" Then
crit_customer = "*"
Else
crit_customer = xlsht3.Cells(3, 5)
End If
sql = "SELECT ........ "
sql = sql & "WHERE (Left([yyyymm],4))= '2007' "
sql = sql & "AND cad_buyer_bill.buyer_name_bill Like '" &
crit_customer & "' "
When I put any customer name, it works, but when I have "1-ALL
CUSTOMERS" it doesn´t work!!!!
What can I do to solve this problem????
Thanks in advance!!!!