BrianBeck
asked on
SQL Syntax error (finding common records in two tables) using VB6
Dear Gurus
I have two tables, and want to use VB6 to list those records where the contents of the COMPANY_NAME field is common to both tables. I've tried the following, but Microsoft says error.
SQLStr = "SELECT FROM DB_ALL_2.COMPANY_NAME " & _
"FROM DB_ALL_2 LEFT JOIN DB_ALL_1 ON DB_ALL_2.COMPANY_NAME = DB_ALL_1.COMPANY_NAME " & _
"WHERE (DB_ALL_1.COMPANY_NAME = DB_ALL_2.COMPANY_NAME)"
Recordset1.Open SQLStr, DbsConnection, adOpenStatic
Microsoft's error is:
'The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect'
I have two tables, and want to use VB6 to list those records where the contents of the COMPANY_NAME field is common to both tables. I've tried the following, but Microsoft says error.
SQLStr = "SELECT FROM DB_ALL_2.COMPANY_NAME " & _
"FROM DB_ALL_2 LEFT JOIN DB_ALL_1 ON DB_ALL_2.COMPANY_NAME = DB_ALL_1.COMPANY_NAME " & _
"WHERE (DB_ALL_1.COMPANY_NAME = DB_ALL_2.COMPANY_NAME)"
Recordset1.Open SQLStr, DbsConnection, adOpenStatic
Microsoft's error is:
'The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER