B
Bob
Hi folks,
I have three tables:
Table1: Contacts (PK = ContactID)
Table2: WebComs (PK = WebComID)
Table3: ContactWebComs (junction table - multi-field PK = ContactID,
WebComID)
I want to get a count of how many WebComs relate specifically to the
current Contact.
I am trying to use the following select statement but it keeps
returning an error 3075 - syntax error, missing operator in query
expression:
strSQL = "SELECT * " & _
"FROM WebComs INNER JOIN ContactWebComs " & _
"ON [WebComs].[WebComID]=[ContactWebComs].[WebComID] " &
_
"INNER JOIN Contacts " & _
"ON [ContactWebComs].[ContactID]=[Contacts].[ContactID] "
& _
"WHERE [Contacts].[ContactID]=" & Me.[ContactID] & _
";"
I'm new at this, and I can't really tell where I'm going wrong.
I've tried varying the select statement by replacing the second Inner
Join with Left Join, but this doesn't seem to resolve my problem.
The first three lines of the query on their own work fine - but they
seem to return the total number of WebComs in the junction table as
opposed to just those which belong to the existing Contact. For
example, if my dummy data shows two WebComs relating to Contact 3,
where one of these also relates to Contact 5, the first three lines
will return 3 - but I want it to return only 2.
TIA
Bob
I have three tables:
Table1: Contacts (PK = ContactID)
Table2: WebComs (PK = WebComID)
Table3: ContactWebComs (junction table - multi-field PK = ContactID,
WebComID)
I want to get a count of how many WebComs relate specifically to the
current Contact.
I am trying to use the following select statement but it keeps
returning an error 3075 - syntax error, missing operator in query
expression:
strSQL = "SELECT * " & _
"FROM WebComs INNER JOIN ContactWebComs " & _
"ON [WebComs].[WebComID]=[ContactWebComs].[WebComID] " &
_
"INNER JOIN Contacts " & _
"ON [ContactWebComs].[ContactID]=[Contacts].[ContactID] "
& _
"WHERE [Contacts].[ContactID]=" & Me.[ContactID] & _
";"
I'm new at this, and I can't really tell where I'm going wrong.
I've tried varying the select statement by replacing the second Inner
Join with Left Join, but this doesn't seem to resolve my problem.
The first three lines of the query on their own work fine - but they
seem to return the total number of WebComs in the junction table as
opposed to just those which belong to the existing Contact. For
example, if my dummy data shows two WebComs relating to Contact 3,
where one of these also relates to Contact 5, the first three lines
will return 3 - but I want it to return only 2.
TIA
Bob