New record 'change' flag

GUIDO22

Registered User.
Local time
Today, 13:24
Joined
Nov 2, 2003
Messages
515
I have a form/ subform but if the user starts to enter data in a new record in the parent form and then closes the form, I need to identify the fact that data has been entered by the user and flag an appropriate message. However, if the user were to make chnages to the sub-form the parent Form_BeforeUpdate() event fires and I can set a 'record changed' flag. But at present the form just closes..... is there a simple easy way that I can identify that changes have been made prior to Form_Update() ??

NB. I have referential integrity configured between the two tables but even this does not flag an error?

Thanks.

Guido
 
If changes are made to a record of a bound form then the Form_BeforeUpdate event *will* fire.
 
The form is bound - but the Update event does not fire! Only does it fire when focus moves to the subform.....
 
Maybe I do not understand the problem. Are you saying when the user makes changes to the SubForm and *not* the main form? If this is the case you can use the BeforeUpdate or AfterUpdate event of the SubForm to flag the Main form to do some testing.
 
RuralGuy said:
Maybe I do not understand the problem. Are you saying when the user makes changes to the SubForm and *not* the main form? If this is the case you can use the BeforeUpdate or AfterUpdate event of the SubForm to flag the Main form to do some testing.

No - the other way around!.
Chnages are made to the main form and the user closes the dialog. To test this - I put a msgbox in the Form_Update event and the msgbox did not display - the form just closed itself.....??? (despite the fact that in table 'relationships' I have identifed the underlying tables as (main form)1->(subform)M).
 
Have a look at the variable DIRTY

You can use the Dirty property to determine whether the current record has been modified since it was last saved. For example, you may want to ask the user whether changes to a record were intended and, if not, allow the user to move to the next record without saving the changes. Read/write Boolean.

George
 
Advertiser,
You should be aware that the Dirty property is a *very special* property. If it is True, then setting it to false actually Saves the record.
 
Pat Hartman said:
You are saying the Form_Update event which doesn't exist. The BeforeUpdate event is always fired (assuming it contains any code) immediately before the record is saved. Closing the form will cause Access to save the record if it is dirty as will moving focus from the main form to a subform or vice versa.

OK Pat - so I didnt get the name of the event EXACTLY right! But you knew where I was coming from.....

I now seem able to trap the event (Form_BeforeUpdate). However, I am able to enter partial info in the main form with no sub-form records. This is not permitted. But the DB does allow the user to move to the next record despite the fact that I have the table relationships set as 1-> M - with the Join type set to Include ALL records from master table and only those records where the joined fields are equal in the subform table...... what have I forgotten?

Regards
G
 

Users who are viewing this thread

Back
Top Bottom