DB Help

JohnGio56

Registered User.
Local time
Today, 13:08
Joined
Feb 12, 2010
Messages
23
Hey guys,

I'm new to the forum and also new to the database field. This is my first project which is exciting because I got while still in school. Right now I'm having some issues. The following error message continues to pop up when trying to enter a record through one of the forms I created. The following error message pops up:

You cannot add or change a record because a related record is required in table <name>. (Error 3201)

Project Background
This entire database was stored on one excel spreadsheet. While attempting to create multiple forms and enter for data I found that all of the data would go into separate records. This was a problem. I now have split the tables and added a unique identifier that will connect them back to the original table. This brings us to right now where I am creating the forms.

Various other troubles
Setting up autotab with numeric value?

  • I want the employees to be able to enter the value and if it meets the requirements then it autotabs.
  • Thanks for any help!
 
............ The following error message pops up:

You cannot add or change a record because a related record is required in table <name>. (Error 3201)

......
This would tend to indicate that you are trying to add a child record to a sub table before the parent record has been saved and thus assigned it's ID (Primary Key [PK]), therefore Access is unable to assign the PK of the parent record to the child records as a Foreign Key (FK).

This may be being caused by a fault in the table design or the form design or both.
 
Without see your table/form structure, it's going to be very difficult to determine how to fix this problem. Any chance of posting a copy of your DB?
 
If you are trying to use a foreign key that does not exist, you will get this error. Make sure the foreign key exists. Ex., lets say you are adding a work order and trying to use customerID 13, but in the customer table there is no customer with an ID of 13, then you will see this error because it violates referential integrity.
 
I have a good understanding of what exactly you guys are saying but unfortunately I can't upload the actual database because the information is confidential. The only part I could show you is the relationship screenshot. Maybe that will help!
 

Attachments

  • RelaScreenshot.jpg
    RelaScreenshot.jpg
    100.4 KB · Views: 102
In your relationship you need a table to store the details of the patient. This table will have a reference number or id for each patient that can be used to link to the relevant tables. You should also have foreign keys in your tables.
If you have a table for the patient with a primary key called pat_id (using your example) then your table Discharge Information would have a Primary Key(PK) say disc_id but it will also have a Foreign Key (FK) pat_id.

You need to redo your relationship layout and remove the mesh arrangement using PKs and FKs.
 
I have a table set up to take on the patient information however it doesn't seem to be taking in the fields when I enter them into a form. What I am thinking is that it's because there are fields in separate tables that combine to the big patient table that have the same fields. I'll try to establish a unique ids for each field so hopefully that works! I would like to establish foreign keys but unfortunately there aren't any fields that can used for it. When creating the db I had to create a primary key on my own because the ones I wanted to use had multiple id's per record, etc. So I created one to link everything together. I get back to you guys on how that works and once I get the main table issues straightened out I'll be back on to chat with you guys about the form creation because I will definitely have some questions. Thanks for you help guys!!
 
First of all, lovely webbings you've got going there :)

Your tables need a complete overhaul and strong normalization for things to work smoothly for you. Read up on that and try to get that bit sorted before considering creating forms. You can of course draw your forms on paper so you have a feel of the flow of data (if it helps).
 

Users who are viewing this thread

Back
Top Bottom