Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Multiple JOINs

Author  Topic 

portrman
Starting Member

24 Posts

Posted - 2000-12-30 : 14:36:49
Hi all, here is my SELECT statement:

strSelectj = "SELECT ContactID, tblTitle.Title, Fname, Lname, tblPhoneCategories.PhoneCategory, Phone1, Comments"
strFromj = " FROM tblContacts"
strJoin = " INNER JOIN tblTitle ON tblContacts.Title = tblTitle.TitleID"
strJoin2 = " INNER JOIN tblPhoneCategories ON tblContacts.PhoneCat1 = tblPhoneCategories.PhoneCatID"
strContacts2 = strSelectj & strFromj & strJoin2
strContacts3 = strSelectj & strFromj & strJoin & strJoin2
rs.Open strContacts3, cn

Error Message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'tblContacts.Title = tblTitle.TitleID INNER JOIN tblPhoneCategories ON tblContacts.PhoneCat1 = tblPhoneCategories.PhoneCatID'.

I am writing a simple address book for myself to learn on and am trying to get the correct Title and Phone Category for each contact in my database. If you are familiar with access I am doing a lookup basicly. The value storied in tblContacts.Title is from tblTitle.TitleID and the value of tblContacts.PhoneCat1 is from tblPhoneCategories.PhoneCatID. I am able to get each join to work by its self either strJoin or strJoin2 but when I combined them in strContacts3 it give me the above error message. I followed the example on this site and everything looks right.

Thanks for the help.
-Chad
   

- Advertisement -