I’m using Access 2007, and I’m very new to it. I apologize if this has been answered before, but my google-fu has failed me!
My question is regarding forms and PKs. I’d like to create a form that enters data into multiple tables. The catch is that one of the form fields is the PK for one of these tables. When I enter a new value in this field (one that isn’t already defined in the table), I get an error stating that the PK can’t be found (naturally).
I’d like the form to go ahead and add the new PK, or even (if we’re getting fancy) to prompt me and ask whether I’d like to add the PK. Is it possible to do this without disabling referential integrity?
Now, for the specifics. I work in a training library that issues technical manuals to instructors, and I created this DB so that I can see information about the manuals, which courses require them, who has requested them, etc. in one place.
The trouble I’m running into is in creating a single form to enter all the data pertaining to a new request.
I often receive requests for publications that aren’t in my inventory, so there is no related record for them in Publications. I’d like my form to create a new record (by which I mean just the PK, I can fill in the rest later), rather than me running into the error message and having to go back and manually add the pub before I can enter the request.
The request form is based on the Requests table and has the following fields (w/related table and column):
FOR - tbl_Contacts - FullName (PK)
DATE, QTY, etc - tbl_Requests
TMIN - tbl_Publications - TMIN (PK) [TMIN = Technical Manual ID Number]
TITLE, MEDIATYPE, etc - tbl_Publications
It works just fine if I remove the PK fields. (As you can see, I also have the PK issue with the FOR field, though it’s not as much of a problem.)
Here are my table relationships (critiques of my structure are more than welcome!). The relevant ones are Publications, Requests, and Contacts:
I’ve successfully created a Publications form with subforms showing Inventory copies, Requests, and Courses for each pub, so my relationships should be sound.
Not sure if I need to do something creative with subforms or what. I’d like this to be as streamlined and user-friendly as possible, in case I ever need to share the DB with my non-tech-savvy coworkers. I’m definitely open to using VBA if needed.
Any tips would be greatly appreciated!
Edit: Download DB