Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    LoserName is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    8

    multi-part identifier could not be bound (#4104)

    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:
    Click image for larger version. 

Name:	could not be bound.PNG 
Views:	35 
Size:	11.9 KB 
ID:	21421

    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!

  2. #2
    LoserName is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    8
    Nobody wants to tackle this one?

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe put square brackets around the table names. [PCutSQL_tbl_user]

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    I wonder why the query engine is converting first underscore in PCutSQL_tbl_user to period.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    LoserName is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    8
    Quote Originally Posted by June7 View Post
    I wonder why the query engine is converting first underscore in PCutSQL_tbl_user to period.
    Huh. I didn't notice that... Good catch! Now what can be done about it?

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by LoserName View Post
    Huh. I didn't notice that... Good catch! Now what can be done about it?
    Maybe you could employ brackets?

  7. #7
    LoserName is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    8
    Quote Originally Posted by ItsMe View Post
    Maybe you could employ brackets?
    Where am I supposed to put brackets exactly? The first two queries run perfectly and the query that throws the error does not directly reference the tables.

    This does nothing:
    Code:
    SELECT qryPrintUsersInternal.[user_id] AS orphanID, qryPrintUsersInternal.[card_number] AS orphanCard, qryPrintUsersInternal.[user_name] AS orphanUsername, qryPrintUsersInternal.[full_name] AS orphanName
    FROM qryPrintUsersInternal LEFT JOIN qryPrintUserAccountDirect ON qryPrintUsersInternal.[user_id] = qryPrintUserAccountDirect.[user_id]
    WHERE (((qryPrintUserAccountDirect.[user_id]) Is Null));

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If you add the brackets to the table names within the first two queries and save the queries, does Access remove them? I would try to add the brackets to the names of the tables.

    If that does not help, I would then start looking into creating a pass through query and using the pass through queries as subqueries.

  9. #9
    LoserName is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    8
    Yes, Access removes the brackets.

  10. #10
    LoserName is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    8
    When I convert the queries to pass-through, it asks for my data source every time and when I select it, I get this error:
    Click image for larger version. 

Name:	call failed.PNG 
Views:	27 
Size:	7.2 KB 
ID:	21461

    Now this is weird...
    In both the Navigation Pane and in the Linked Table Manager, it shows and underscore between PCutSQL and the table name:
    Click image for larger version. 

Name:	linked tables.PNG 
Views:	27 
Size:	25.1 KB 
ID:	21459

    But when I look at the ODBC objects in Import and Link, there is a period:
    Click image for larger version. 

Name:	import.PNG 
Views:	27 
Size:	19.6 KB 
ID:	21460

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Hmmm, you should be able to use the actual table names since it is a pass through. Within your pass through query try typing the name as PCutSQL.tbl_user rather than PCutSQL_tbl_user.

    As for the security thing, you will have to use the same credentials that your linked tables are using.

    The only other thing I can think of and I do not think it will help, would be to use alias names for your tables within the SLECT statement of the first two queries. But, I think the error is happening when the subqueries are using the SQL engine.

    So maybe something like ...
    Code:
    SELECT a.user_id, a.card_number, a.user_name, a.full_name
    FROM PCutSQL_tbl_user AS a INNER JOIN PCutSQL_tbl_user_group ON a.user_id = PCutSQL_tbl_user_group.user_id
    WHERE (((PCutSQL_tbl_user.deleted)="N") AND ((PCutSQL_tbl_user_group.group_id)=5014));

  12. #12
    LoserName is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    8
    Hmm, no it still asks for the data source and gives the ODBC error.

    I also attempted aliases for every table and still got the "could not be bound" error.

    Sorry I didn't respond sooner- I've been out a few days...

  13. #13
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by LoserName View Post
    Hmm, no it still asks for the data source and gives the ODBC error.
    ...
    If it is asking for the data source it is probably not the same error. So you will need to connect to the server before you can use the Pass Through query. Looking at one of your screenshots it appears your tables are linked. So the connection string for the query will look like the strings for your tables. If you include the name of your database in the string your table names within your query will probably look like (MPSGroupManagers or tbl_account). If you get the connection string correct and the table name wrong the error should tell you that the table name is wrong.

    Here are some examples of connection strings.

    you can a put something like the following into the Connection String Property of a passthrough query. Take a look at one of your linked tables and check the Description property. All of this stuff is available via the property sheet while in design view.
    Code:
     ODBC;DRIVER={SQL Server Native Client 11.0};SERVER=tcp:ServerName.domain.local,1433;Database=DataBaseName;UID=UserName;Pwd=P@$$W0RD;Encrypt=Yes
    You can also change the connection property of a pass through query using code ...
    Code:
    'Programatically adjust the ODBC Connection String
    'of a passthrough query named Query1
    Dim db As DAO.Database
    Dim qdf As DAO.QueryDef
    Dim strConnect As String
    
    strConnect = "ODBC;" & _
                 "Driver={SQL Server Native Client 11.0};" & _
                 "Server=tcp:ServerName.domain.local,1433;" & _
                 "Database=DataBaseName;" & _
                 "Uid=UserName;" & _
                 "Pwd=P@$$W0RD;" & _
                 "Encrypt=yes;" & _
                 "Connection Timeout=30;"
                 
                 
        Set db = CurrentDb
        Set qdf = db.QueryDefs("Query1")
        qdf.Connect = strConnect
        
        Set qdf = Nothing
        Set db = Nothing

  14. #14
    lbrannon is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Posts
    6
    I know this post is over a year old, but I'm having this exact same issue with no luck finding a solution. Were you able to get this working?


    Quote Originally Posted by LoserName View Post
    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:
    Click image for larger version. 

Name:	could not be bound.PNG 
Views:	35 
Size:	11.9 KB 
ID:	21421

    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!

  15. #15
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    @lbrannon
    I see more than one issue in this thread. Perhaps you can start a new thread and identify what issue you are having. You can also link to this thread as reference.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 01-16-2015, 09:28 AM
  2. Replies: 6
    Last Post: 01-30-2014, 05:57 PM
  3. How Can export Large table part by part
    By shabar in forum Import/Export Data
    Replies: 2
    Last Post: 02-04-2013, 06:29 AM
  4. Replies: 14
    Last Post: 12-15-2012, 02:59 AM
  5. Bound form with bound combobox
    By Jerry8989 in forum Access
    Replies: 2
    Last Post: 12-05-2011, 01:50 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums