Results 1 to 12 of 12
  1. #1
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243

    Join Error

    Help please with this error message:


    Goal: to create a one-to many relationship join between two tables
    Error message: Relationship must be on the same number of fields with same data types.

    The error message may seem self-explanatory, but, as a newbie I don't have a clue.
    Last edited by RuralGuy; 09-12-2011 at 12:11 PM. Reason: added the picture

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What are the DataTypes of the two fields?

  3. #3
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Right now ALL fields in BOTH tables are text fields. However, two caveats that may be useful:
    1. Both tables are imported Excel files;
    2. The GrantID fields that comprise the join are numbered thus: 05_03. Could the underscore be the issue?

  4. #4
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Whoops: One field is a date/time field. But it's not the "common" field that creates the join.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I don't think the underscore is an issue. Did you index the GrantID field in the 2nd table? FYI, it is always a good idea to name the ForeignKey fields the same and the PrimaryKey field it represents. It is also a good idea to name the PrimaryKey field something descriptive of the table. You have a GrantID field in both tables but they are not the same data?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The two Join fields *must* be the same DataType.

  7. #7
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Still not successful. To make things simpler I created two very basic tables. Please see image linked.
    I took your advice as to relabeling the foreign and primary keys. The primary keys are Long integer data types (that's autoset by the software). The other fields are all text fields. When I try to create a one-to-many join (advisors have many students), I still get the same error message.

    Watched some tutorial videos over the weekend and I feel like I'm doing the join correctly in the sense that I'm dragging the primary key from the Advisors table onto the Student field in the students table. Is that correct? Although, that's where I'm really confused because Advisor_ID [primary] is a long integer data type and Advisor in Students table is a text data type. If that's the error that Access is identifying I'm flummoxed because if the primary key is not a long integer then it ceases to become a primary key, if I understand this correctly.
    Last edited by snowboarder234; 09-19-2011 at 02:36 PM. Reason: typo

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The Advisor field in the Students table needs to be a LongInteger.

  9. #9
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Quote Originally Posted by RuralGuy View Post
    The Advisor field in the Students table needs to be a LongInteger.
    Sorry to seem dense -- but how does one change the type filed from data to long integer. In design view, when I use the pull down menu for field type the integer option does not appear. If I type it in I get this error message.
    Last edited by snowboarder234; 09-19-2011 at 06:36 PM. Reason: linking

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You would pick Number and then select LongInteger down below.

  11. #11
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Well, that resolved the join error. But now I can't put text into the advisor field -- only numbers. Access 2003 was so much easier.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Create a query that joins the two tables on the Advisor field and you can include fields from both tables as if they are in the same table. It was the same in ac2003.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 06-13-2011, 06:04 PM
  2. Replies: 8
    Last Post: 05-12-2011, 06:11 PM
  3. Ambiguous Outer Join Error
    By scruiks in forum Queries
    Replies: 3
    Last Post: 07-18-2010, 05:06 PM
  4. Error on Multiple Table Join & IIF
    By cmartin in forum Queries
    Replies: 1
    Last Post: 05-21-2010, 08:58 PM
  5. Error using left join accessing 2 active connections
    By peterg2000 in forum Programming
    Replies: 0
    Last Post: 10-05-2009, 05:04 PM

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