Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2021
    Posts
    9

    Access searches for a matching record before it becomes necessary (Error 3101 in tab control)

    Hi everyone!




    I have two tables in a "one to many" relationship (see figure 1).

    Click image for larger version. 

Name:	Figure 1.png 
Views:	20 
Size:	14.9 KB 
ID:	45001


    To introduce data in the "many" side table, I use a form with a tab control (see figure 2). The tab control has three pages and all the text and combo boxes are arranged in such a way that it is useful to the user.

    Click image for larger version. 

Name:	Figure 2.jpg 
Views:	20 
Size:	75.6 KB 
ID:	45002


    Obviously, because of the "one to many" relationship, I don't want the user to be able to add a record on the "many" side for which there is no matching record on the "one" side. That is why there is a combo box on the second page where the user selects from a list a matching record on the "one" side table (see figure 3). After the user selects a value from the list, all the other fields from the "one" side table are auto-filled, just for the user to see their values.

    Click image for larger version. 

Name:	Figure 3.jpg 
Views:	17 
Size:	64.5 KB 
ID:	45008


    I want the user to be able to navigate through all three pages while entering the data at their own pace, and, when they finish and make click on the green Save button, I want Access to verify if there is a matching record. The problem is that, while the user is completing the information on the first page, Access shows up the warning "The Microsoft Access database engine cannot find a record in the table with key matching field. (Error 3101)" (see figure 4). Of course, at this point, there is no matching field, because the combo box to do that is on the second page of the control tab.

    Click image for larger version. 

Name:	Figure 4.png 
Views:	20 
Size:	6.6 KB 
ID:	45004


    Does anyone know why Access makes that verification if the user hasn’t saved the record yet?
    Does anyone know why Access makes that verification if the user has not even modified the combo box with the foreign key yet?
    Does anyone know how I can have Access do the verification only when you click on the save button and not when the user navigates through the tab control pages?

  2. #2
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    Hi

    You should rearrange your Tab Page Order so that the user first makes a selection from the One Side (parent)
    then they can add data for the Many side.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    Or open with only 1 tab showing. When it's complete show the next or next 2. Or do similar but with a main form & subform(s).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 9
    Last Post: 11-07-2017, 03:40 AM
  2. Replies: 23
    Last Post: 01-27-2016, 01:42 PM
  3. Replies: 3
    Last Post: 12-19-2014, 12:06 PM
  4. Handling Error 3101 in Forms
    By draz in forum Forms
    Replies: 3
    Last Post: 08-23-2011, 08:34 AM
  5. Error 3101 (but it shouldn't?..)
    By opopanax666 in forum Programming
    Replies: 4
    Last Post: 12-09-2010, 09:07 AM

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