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

Check to see if form or subform is dirty.......

Status
Not open for further replies.

Oliver2003

Technical User
Joined
Apr 19, 2003
Messages
144
Location
GB
Hi,

I have a form with a sub form - in the main forms before update I have the following code:
If Me.Dirty Then
If MsgBox("Do you want to save changes", vbYesNo, "Save?") = vbNo Then
Me.Undo
End If
End If

to check if there have been any changes made - this works fine on the main form but does not pick up any changes on the subform

Is it possible to detect changes made on the subform without putting code in the subforms before update event?

Thank you
 
I think

If Me.SubFormName.Form.Dirty

should work.

Haven't tried it though, so I'm not sure......

Ed Metcalfe.

Please do not feed the trolls.....
 
ed2020, thanks for the reply -I tried that but it does not seem to work

Any other ideas??
 
Oliver2003,
I think your sub-form is saving the record as soon as you are changing focus to another control on the main form.

You could try putting your same code into the _BeforeUpdate() event of your subform...

All though not as elegant as you were expecting, it would at least prompt the user to verify the changes to each sub-form.

I was having the same trouble on a similar project, and finally decided to leave the undo out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top