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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form & Subform processing to resolve one to one or more

Status
Not open for further replies.

topazny

IS-IT--Management
Apr 26, 2002
3
GB
I have the following tables:
Parent Table:

Table Name: Raw_Data_A
Raw_data_A_ID (PK) Autonumber
LSExpert
Date_of_training
Team_being_trained
Module
Comments



And the following child table:
Table Name: Raw_Data_B
Raw_Data_B_ID (PK) Autonumber
Raw_Data_A_ID
Attendee Name

I have a one to many relationship from Raw_data_A to Raw_Data_B with the Raw_Data_A_ID field being used in the relationship. I.e. 1 Raw_data_A.raw_data_A_id to MANY Raw_Data_B entries



I have one form with a subform on it that has the following:
On the Left - this form populates the parent table (Raw_Data_A)

On the right - I would like this form to be mandatory for each entry on the left hand side. This form will populate the child table on the many side of the relationship (Raw_Data_B)


In essence I would like to have it such that when the user finishes entering the comments on the "parent" side of the form, it should only save to the tables if the user also enters data on the "child" side of the form.


I have tried to create an "Event Procedure on Before Update" on the parent form that reads as follows:


IIf (IsNull [attendee name], "No name enteres. please Enter Name", DoCmd.save)


However this does not seem to work.

If anyone can help or provide some sample code to do this I would be grateful. I'm not a technical person, and have basically been reading up on Access and "Building applications in Access". Sadly they do not seem to provide sample code for this type of thing.
 
Well, I think your problem might be that, with referential integrity, you won't be able to enter any CHILD records until the PARENT record is SAVED in the table - and you can't really do it all in one step.

You'll HAVE to save the parent record, then go to the form with the child records and add them. I can think of NO way to add the child record(s) until the parent is there to validate them.

However, you CAN control the operation a bit, by using some code that, AFTER the parent-save, displays a message box and "instructs" the user to enter the child records. And you can trap a form close or record movement and keep them from happening UNTIL that condition is met.

Hope this helps a bit.

Jim
How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top