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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to query multiple tables

Status
Not open for further replies.

ma701sd

IS-IT--Management
Dec 15, 2000
94
GB
Hi,

Im trying to perform this query but I keeopetting an error saying:
ODBC Error Code = S1000 (General error)


[Microsoft][ODBC Microsoft Access Driver] The specified field 'UserName' could refer to more than one table listed in the FROM clause of your SQL statement.



The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (8:3) to (8:50).


The query I'm trying to perform is :

SELECT UserName
FROM (((Users INNER JOIN Links ON Users.UserName = Links.UserName)
INNER JOIN Section1 ON Users.UserName = Section1.UserName)
INNER JOIN Section2 ON Users.UserName = Section2.UserName)
INNER JOIN Heading ON Users.UserName = Heading.UserName

WHERE (((Heading.UserName)='#client.username#') AND
((Links.UserName)='#client.username#') AND
((Section1.UserName)='#client.username#')AND
((Section2.UserName)='#client.username#'));

This has worked for other queries so why will it not work here?

Is my query wrong?
Cheers
Sam...
 
Change the first line of your query to be:

SELECT Users.UserName

Since you have a UserName column in all of the tables used in your query, Access does not know which one you want and will return that error unless you specify. Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top