Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RUNTIME ERROR 3201....HELP PLEASE!!!!

Status
Not open for further replies.
Aug 23, 2005
43
US
Hi all!
I have an access database that is replicated on a dozen mobile computers, that my company's sales reps use. Each sales rep has his/her territory. Code was written to extract territory specific info from the tables, to be displayed in a data entry form with only that info. The code then makes temporary tables to add, edit, and delete. Upon "unload" the code moves the info from the temporary tables and moves them to the main tables. Then it deletes info from the temp tables. The problem is that upon exit, I am getting this error instead of the code running queries to do the above mentioned. Any suggestions?

Madetoheal13
 
Madetoheal13

Error 3021 is:
You cannot add or change a record because a related record is required in table '|'.

This would make it seem that the code is trying to add data to a table which requires a related table. For example, a one-to-many table relationship where a record is needed on the One side in order to put a record in the Many side.

Tom
 
Hey THWatson thanks!

However, I have checked and all my tables are correctly related all with rules of referential integrity. I am not sure where to go from there.

Madetoheal13
 
Madetoheal13
If I understand correctly, the data is not being properly written to the tables.

It would seem, then, that things are somehow happening out of order.

What happens if you add a command button and put the code (to make your table, run queries, etc.) behind the button? Then everything would happen before the form is closed.

Also, you don't actually have to delete the information from the temporary table, as it will be re-written each time the make table query is run.

Tom
 
How is the data getting moved?

Action query?
DAO?
ADO?

However you move the data, you might check that all of your primary and foreign keys are getting filled with data. If one is empty, you'd still get this error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top