Bound forms. Moving to next form before saving record.

mafhobb

Registered User.
Local time
Today, 15:24
Joined
Feb 28, 2006
Messages
1,249
So I have a bound form with a bound continuous subform in it. The form contains customer data and the continuous subform contains properties that this customer owns. On the same continuous subform there is a button that takes you to the property's details form, also bound.

On the subform, a user can simply add a new property by navigating to the last, empty record and adding new data. Exiting the record saves it in the appropriate table.

The problem comes when the user clicks on the command button to add property details before exiting (tabbing out of) the new property record in which case the property details form opens up with anew record, not related to the new property.

I know that this happens because the new property record has not been saved yet before clicking on the button to add details to it.

How can I prevent this form happening? How can I make sure that if the user click on this button to move on to the next record, that the new, partially entered record is saved?

Thanks

mafhobb
 
if you have a subform AND it is bound to the parent form (via key field)...
then every new record is bound to the parent form.
every record gets saved when you leave the record, or click the save button.
 
So why is it that when the second form is opened right after the fields in the subform records are entered the second form comes up empty? Instead, if I tab out of the new subform record, click on it to select it again and then open the second form, it is all OK.

This is the code to open the second from from the subform button:

DoCmd.OpenForm "frmPropertyDetails", , , "PropertyID = " & Me.txtPropertyID

mafhobb
 
before opening the second form from the subform button, save the record and recalculate the subform:


Me.Dirty=False
Me.Recalc
DoCmd.OpenForm "frmPropertyDetails", , , "PropertyID = " & Me.txtPropertyID
 

Users who are viewing this thread

Back
Top Bottom