Linking data on two forms

Peter Bellamy

Registered User.
Local time
Today, 18:33
Joined
Dec 3, 2005
Messages
295
I have two forms created, a master and another which is sometimes required for additional data. They are NOT form and subform. They refer to two seperate tables.

The optional form opens on a button that appears if conditions are met and when open writes the record number of the master form into the 'record' field of the other form. This is done by setting its control source equal to the value of the master record number.
It appears on the form correctly.

The problem is that it is not remembered when the optional form is closed.
Allthough all the manually entered data is.

I have tried forcing an save, no different.
I have tried VBA coding the field to the master form value and it errors because it conflicts with the control source statement.

What is the way?

Whilst writing this I have had an idea; put an unbound control equal to the master record number, then code writing the value in the unbound control to the field? I will try this when I get back to work (where the db is)

Has anybody got a better suggestion?

Thanks
 
Are you sure that the first form saves the record before oping the second form.


If it were me, I would use a tab control and place the pop form on the tab control as a sub form. This is a perfect use of a sub form (editing data multiple tables). This way Access will automatically handle this for you.
 
Thanks for the reply.
I will check if it saved, maybe force one on opening the optional form to test it.

Can a subform be made to be visible/invisible according to the details on the on the master form?
That what I am doing with the button on the master.
This is because the optional form in not approprate for certain data entries on the master.
 
Thanks for the reply.
I will check if it saved, maybe force one on opening the optional form to test it.

Can a subform be made to be visible/invisible according to the details on the on the master form?
That what I am doing with the button on the master.
This is because the optional form in not approprate for certain data entries on the master.

That is why I suggested using a Tabbed control on the form. You could hide the tab so that the user can not select the tab to get the the sub form unless it applies.


Before opening the second form use this to force the record to be saved:

Code:
If Me.Dirty Then Me.Dirty = False
 

Users who are viewing this thread

Back
Top Bottom