Page 1 of 4 1234 LastLast
Results 1 to 15 of 48
  1. #1
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52

    Linking Tables for Queries, Forms and Reports


    Hello, it's been a while since I've been here. All the help I received before kept me from having to come back.
    I have two tables Lead tbl and Asbestos tbl
    I have a form to input the information.

    Right now I am set up like this. I have tried it every way I can think of.

    Click image for larger version. 

Name:	Set Up.PNG 
Views:	41 
Size:	3.3 KB 
ID:	48656



    I put the first record set in and it works great. When I try to input the 2nd record in my form, I get this.

    Click image for larger version. 

Name:	Access Error MSG.PNG 
Views:	41 
Size:	7.1 KB 
ID:	48658



    Asset ID is a unique number in both tables. I am trying to input into both tables (and report) based on the Asset ID. What am I doing wrong?

    The frustrating thing is I've done it before, I'm just so old I can't remember how.

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    how is your table keyed? are you entering it twice? you cannot duplicate the same key.
    does it have a subtable?

    we need to see table designs, form designs.

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,537
    Asset ID is a unique number in both tables.
    So how are the tables related to each other. It may help if you can tell us something about your tables an what they represent
    BTW it's not considered good practice to have spaces in the names of any objects in Access. So, tblLead and tblAsbestos would be better.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    They Are currently keyed as above. Like this:

    Click image for larger version. 

Name:	Set Up.PNG 
Views:	42 
Size:	3.3 KB 
ID:	48659

    I have tried it every other way I can think of. In my Lead table, I made the Asset ID the primary Key and tried to link it to the Asset ID in the Asbestos table. I tried it in reverse.

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,537
    You appear to have two tables with the same data fields. Tell us what the db is about. IMHO your tables are wrong.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    It is about Lead and Asbestos testing and results. One table is Lead. The other is asbestos. I am trying to use one form to register the tests and results for the Asset. Each Asset has a unique number. It is really the only thing in common between the two tables. I do have two tables with the same data fields - Asset ID is in common with the two.

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    This should one table with an extra field TestType (or similar) with values Lead or Asbestos. If in the future you need to add tests for e.g. Radon then no further redesign would be needed
    You would then use a self-join query based on AssetID to replicate what you are doing now
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #8
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    OK, thanks.

  9. #9
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    Keeping your same basic design, you could set up a main form with a tab control using 2 tabs. One tab for lead and the other for asbestos.
    For this to work you would need an Asset table for the main form (which you must already have).

    The lead and asbestos tables would not be linked to each other, but each linked to the Asset table.

  10. #10
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    Thanks Dave, that's the way I had it, but I need it all on one form. I'll just make it one table, probably the easiest way to do it.

  11. #11
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    Well, one table won't work. I hit the field limit.

  12. #12
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,537
    Quote Originally Posted by OlBill View Post
    Well, one table won't work. I hit the field limit.
    Can you post a copy of your db
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  13. #13
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    OlBill,

    Further to Bob Fitz request, could you please give us an overview of your project. Just the 30,000 ft level stuff to help us understand what the pieces are and how they relate to one another. Maybe you could tell us how you hit the field limit.

  14. #14
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Quote Originally Posted by OlBill View Post
    Well, one table won't work. I hit the field limit.
    That infers that the structure is completely incorrect?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  15. #15
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    Quote Originally Posted by Bob Fitz View Post
    Can you post a copy of your db
    I don't know how to do it. I found it.

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

Similar Threads

  1. Replies: 34
    Last Post: 07-04-2021, 04:55 AM
  2. Replies: 2
    Last Post: 03-13-2018, 12:32 PM
  3. Replies: 9
    Last Post: 07-19-2017, 11:01 AM
  4. Replies: 6
    Last Post: 10-16-2014, 12:55 PM
  5. Linking 2 Tables or Queries
    By vdanelia in forum Database Design
    Replies: 4
    Last Post: 03-01-2011, 03:07 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