Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Syntax Error in Where clause

Status
Not open for further replies.

seanybravo

IS-IT--Management
Sep 24, 2003
89
GB
I am using this SQL statement on my ASP VB pages linking to an access database Jet 4.0. The query works fine until I put a OR statement on the where clause. I am sure its a bracketing problem but cant for the life of me sort it out. I have tried recreating the query in access and looking at the SQL generated by that but no joy. Any help would be appreciated. Thanks.

SELECT tblData.*, tblTitle.*, tblCustomCategory.* FROM (((((tblData LEFT JOIN (SELECT * FROM tblTitle IN 'E:\Websites\ebusinessdirectories\Database\Admin.mdb') AS tblTitle ON tblData.fldContactTitle = tblTitle.fldTitleID) LEFT JOIN tblCustomCategory ON tblData.fldCategory1 = tblCustomCategory.fldID) LEFT JOIN tblCustomCategory AS tblCustomCategory1 ON tblData.fldCategory2 = tblCustomCategory1.fldID) LEFT JOIN tblCustomCategory AS tblCustomCategory2 ON tblData.fldCategory3 = tblCustomCategory2.fldID) LEFT JOIN tblCustomCategory AS tblCustomCategory3 ON tblData.fldCategory4 = tblCustomCategory3.fldID) WHERE ((((tblCustomCategory.fldDefinition)) = 'A_Sean[0]')) OR ((((tblCustomCategory1.fldDefinition)) = 'A_Sean[0])) ORDER BY fldCompanyName
 
WHERE ((tblCustomCategory.fldDefinition = 'A_Sean[0]') OR (tblCustomCategory1.fldDefinition = 'A_Sean[0][red]'[/red]))
 
Jerry

I am tring to add a LIKE condition to the WHERE cluase insted of the =. LIKE '*Sean[0]*' but I am having problems the Syntax checks out but I am getting no search results. What am I doing wrong?

Thanks for you time.
 
If you use ADO:
LIKE '%Sean[0]%'

If you use DAO:
LIKE '*Sean[[]0[]]*'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top