[AccessD] Like Operator SQL Syntax

jeffrey.demulling at usbank.com jeffrey.demulling at usbank.com
Thu Jun 5 10:18:19 CDT 2003


Try this:

strSQL = "SELECT tblCustomers.CustomerID, "
strSQL = strSQL & "[tblCustomers]![CustomerNumber] & '-' & 
[tblCustomers]![CustomerSite] " 
strSQL = strSQL & "AS CustCode, tblCustomers.CustomerName, 
tblCustomers.Address1 & ' ' & "
strSQL = strSQL & "tblCustomers.Address2 & ' ' & tblCustomers.Address3 & ' 
' & "
strSQL = strSQL & "tblCustomers.Postcode AS Address, tblCustomers.DepotID 
FROM tblCustomers "
strSQL = strSQL & "WHERE (((tblCustomers.CustomerName) Like % + "
strSQL = strSQL & strInput & " + %)) "
strSQL = strSQL & "ORDER BY tblCustomers.CustomerName;"




ACTEBS <actebs at actebs.com.au>
Sent by: accessd-bounces at databaseadvisors.com
06/05/2003 09:55 AM
Please respond to accessd

 
        To:     "access group" <accessd at databaseadvisors.com>
        cc: 
        Subject:        [AccessD] Like Operator SQL Syntax


Hi People,
 
Can anyone tell me what wrong with the following syntax:
 
strSQL = "SELECT tblCustomers.CustomerID, " _
            & "[tblCustomers]![CustomerNumber] & '-' & 
[tblCustomers]![CustomerSite] " _
            & "AS CustCode, tblCustomers.CustomerName, 
tblCustomers.Address1 & ' ' & " _
            & "tblCustomers.Address2 & ' ' & tblCustomers.Address3 & ' ' & 
" _
            & "tblCustomers.Postcode AS Address, tblCustomers.DepotID FROM 
tblCustomers " _
            & "WHERE (((tblCustomers.CustomerName) Like % + " _
            & strInput & " + %)) " _
            & "ORDER BY tblCustomers.CustomerName;"
 
I am creating an ADO recordset and obviously ADO use % as the wild card 
and not * so I am not sure where the issue currently is...
 
Thanks
Vlad
 _______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030605/d3902720/attachment-0001.html>


More information about the AccessD mailing list