Validating Records

jxd914psu

Registered User.
Local time
Today, 08:04
Joined
Jul 16, 2007
Messages
14
All I really need some help.

I have two tables:

Table 1
Table 2

There is a one to many relationship here.

One in table 1 and many in table 2.

When I add in a record in table 1, I need a validation script/key that won't allow adding a record to table 1 without a corresponding record in table two.

Please help. I'm really stuck. I am doing this through a form. I tried messing around with the "requirements" but had no luck.
 
That is the wrong way round. in order to enter a record on the many side (in your case table 2) then a record is required in table 1.

If you set the foreign key in table 2 to required the jet runtime will display an error message and will not save the record.
 
Bascically what is going is this:

For one table if a record is entered in... it needs a corresponding record in the other table. Vice versa. It cannot exist unless it you enter in records in both tables. I don't want it to save unless it has data in both tables.
 
not with a one to many relationship like this.
If only one record is required in each table then set the table to one to one BUT you will still have the same problem. If both tables are equal in the sense that from a systems point of view it doesn't matter which record is entered into which table first then you as the developer need to designate one table as the master table and ensure the following condition.

If you exit the form after having entered only the master record then display a message to continue or not. If not then delete it.

If both records have been entered and one is deleted then again warn the user and either allow the record to be entered or delete the orphaned record.
 
Thank you sooo much. That is exactly what I am looking for. I am sorry I am new to access you you be able to help me further by showing me how to do this in detail?

Thanks again.
 
I have it set up by main form has table one information. I have a subform embedded in the mainform with table two info. I want to have all fields filled in mainform and subform or it cannot save.
 

Users who are viewing this thread

Back
Top Bottom