Before Update or some other event ???

Donna Tunstall

Registered User.
Local time
Today, 11:48
Joined
Aug 16, 2001
Messages
17
Hi All - having some problems wrapping my head around this and am stumbling dramatically. Can anyone help shed some light on what I should be doing and how I can improve it perhaps.

I have a Main Form with Header information, and a Sub Form with detail information. I want to ensure that all necessary fields on the Main Form are completed and all necessary fields on the Sub Form are completed.

The BeforeUpdate event on the Main Form checks to make sure that certain fields are entered (e.g. if the Sales Rep is blank a message box pops up asking for Rep name) and the BeforeUpdate event on the Sub Form does the same thing (message boxes)

Now then, a user can either be entering a complete record for the first time or editing a record for any particular reason; during editing sometimes it may be a field ONLY on the main form that changes, or it might be a field ONLY on the sub form.

Bottom line, when everything is done I would like to show a message box “Are you sure you want to update this record”, if Yes, “Saved”, if No “Not Saved” type thing.

Here’s my problem – where do I put this???? If I put it in the Before Update event of the Main Form, I get a message box asking if they want to update the record EVERY TIME the focus moves from Main Form to Sub Form (v. annoying). But if I only put it in my Sub Form and they come back and just edit a field on the MAIN FORM they won’t be prompted for anything.

Thanks in advance.
 
The problem you are running into it this:

1. Going from the Main Form to the Subform and subform to main form fires the UpdateEvents.

The only way to do this would be to have the forms unbound and adding a Command to do the update.
 
Thanks Travis. Guess I'll have to eek back to the drawing board and figure out a fix (oh the joy, the joy).

Donna
 
Try looking at the Dirty property in VBA, that may help in your quest.

Ian
 

Users who are viewing this thread

Back
Top Bottom