Hello!
I'm getting an error when attempting a query: multi-part identifier could not be bound (#4104).
My goal: I need to return records for users from a query that are not found in another query.
First, let me state that I have no control over any of the tables referenced and they are stored in SQL Server with an ODBC connection to Access.
The first query returns records of what are known as internal users from a table that contains both internal and external users:
Code:
SELECT PCutSQL_tbl_user.user_id, PCutSQL_tbl_user.card_number, PCutSQL_tbl_user.user_name, PCutSQL_tbl_user.full_name
FROM PCutSQL_tbl_user INNER JOIN PCutSQL_tbl_user_group ON PCutSQL_tbl_user.user_id = PCutSQL_tbl_user_group.user_id
WHERE (((PCutSQL_tbl_user.deleted)="N") AND ((PCutSQL_tbl_user_group.group_id)=5014));
The second query returns records of users that belong to shared accounts from a table that contains both shared and personal accounts:
Code:
SELECT PCutSQL_tbl_user.user_id, PCutSQL_tbl_user_account.account_id
FROM (PCutSQL_tbl_user INNER JOIN PCutSQL_tbl_user_account ON PCutSQL_tbl_user.user_id = PCutSQL_tbl_user_account.user_id) INNER JOIN PCutSQL_tbl_account ON PCutSQL_tbl_user_account.account_id = PCutSQL_tbl_account.account_id
WHERE (((PCutSQL_tbl_account.account_type)="SHARED"));
And finally, I have an unmatched query to return users that are internal and not a member of any shared accounts:
Code:
SELECT qryPrintUsersInternal.user_id, qryPrintUsersInternal.card_number, qryPrintUsersInternal.user_name, qryPrintUsersInternal.full_name
FROM qryPrintUsersInternal LEFT JOIN qryPrintUserAccountDirect ON qryPrintUsersInternal.[user_id] = qryPrintUserAccountDirect.[user_id]
WHERE (((qryPrintUserAccountDirect.user_id) Is Null));
This final query returns the following error:
I'm sure I could get this working if I created temp tables but I don't think that should be necessary and I'd rather learn the right way. I have found other posts on this error but they didn't seem similar enough for me to figure out my problem. Any help would be greatly appreciated!