Results 1 to 4 of 4
  1. #1
    UserX is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    30

    Trying To Understand Table Relationships

    I certainly understand the importance of referential integrity (RI); however, RI means nothing if data can't be entered. Thus my problem.

    I want to create a database (for my own personal reasons - not required by employer) to help me keep track of licensed software deployed. For example, if we (company) have a volume license agreement for 500 users, I want to track the following:

    Product
    Date installed
    Name of admin whom installed
    Computer installed on
    And any other pertinent info (which, ironically, is not pertinent to this inquiry)

    Prologue: I have started with creating tables and I know how, in a literal sense, to create relationships. What floors me is how to collect data.

    I want to use my form, frmNew_Installs for data input, and envisioned making input easier by having a combobox with all available licensed software. The rest of the info has to be typed in. This form is bound to a table, tblInstalls. On frmNew_Installs, I have submit button whose sole purpose is to move to the new record in tblInstalls. The code behind the button is:
    Code:
    Private Sub btnSubmit_Click()
    
    DoCmd.GoToRecord , , acNewRec
    End Sub
    The problem is that when this button is clicked, I get an error message "Run-time error '2105': You can't go to the specified record." So, I went to the table to enter data, and when I click on the second row (table has only one row of data), I get the following message: You cannot add or change a record because a related record is required in table 'tblUsers'.



    What I need help with is understanding how data is supposed to flow in related tables. In other words, why does data have to be entered into 'tblUsers' prior to being entered into 'tblInstalls'? For that matter, since there seems to be a priority list, how am I supposed to know which table needs to have input first? Trial and error?

    Attached is my db. Thank you for your time.
    Attached Files Attached Files

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can't look at the sample right now, but generally you'd need to have the "one" record first in a one-to-many relationship, which is likely what yours is (one user can have many products).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    Because you have enforced RI you'll need to enter records for tblUsers prior to tblInstalls and tblComputers (which reference the corresponding tblUser records). Likewise tblProducts records must be entered prior to referencing the record in tblComputers. The parent record must be entered prior to the child for one-to-many relationships when you have selected to enforce RI

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You have unnecessary fields in some tables ("product name" in tblComputers is one example).

    I did a quick modify of the tables and populated tables based on fields in tblMBAM. So not good data but good enough to demo the dB.
    Look at the relationship window.......

    "frmNew_Installs" is data entry only.
    I added "frmInstall_Details" to view "tblInstalls".

    Not sure what "tblMBAM" is for.......
    Last edited by ssanfu; 08-13-2015 at 05:15 PM. Reason: oops... forgot to attach dB

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

Similar Threads

  1. I do not understand the steps
    By Lou_Reed in forum Access
    Replies: 4
    Last Post: 07-23-2015, 11:20 AM
  2. Trying to Understand Relationships
    By Bkper087 in forum Access
    Replies: 3
    Last Post: 10-10-2014, 12:42 AM
  3. Help me understand normalization and what it looks like
    By njnewuser in forum Database Design
    Replies: 2
    Last Post: 04-01-2014, 12:33 PM
  4. Someone to help me understand a guide
    By carrybag93 in forum Access
    Replies: 4
    Last Post: 06-04-2012, 12:20 AM
  5. Need to understand code
    By accessnewb in forum Programming
    Replies: 2
    Last Post: 08-03-2011, 12:03 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