Choosing to save data or not in subform

  • Thread starter jdtyler via AccessMonster.com
  • Start date
J

jdtyler via AccessMonster.com

I'd like to have a button on my subform that saves changes that a user has
made to a record but doesn't save any changes if the record is changed etc
without pressing the button. I've tried using Me.Undo etc but this always
destroys the data? Any ideas how I can achive this?

Thanks again for your help.
 
F

Frank Pullar

Hi,

how about using the message box?

Put the following code into the before update event of your form:
-------
Dim int as Integer

If Me.Dirty Then
int = MsgBox("Save?", vbYesNoCancel + vbQuestion)
Select Case int
Case vbYes 'saves the changes
Case vbNo 'undo changes
Me.Undo
Case vbCancel 'cancel event
Cancel = True
End Select
End If
 
J

jdtyler via AccessMonster.com

Thanks for the response. This would trigger a message box even if the user
has clicked the button on the form to save the changes. As such, they'd need
to confirm twice. Do you get what I mean?

Thanks
 
F

Frank Pullar

I think I do.

So, how about using a dummy save button on a separate subform. Resize this
subform to the size of the button. When the user clicks on this new subform,
he appears to be clicking the save button. The before update event your other
subform is triggered and the message box appears asking for confirmation.

Not the cleanest solution, I know.

Otherwise, I can only think of working with unbound forms and temporary
tables.
This involves alot of coding and I don't have much experience using these yet.

Sorry.
 
J

jdtyler via AccessMonster.com

No, that's great. Thanks

Frank said:
I think I do.

So, how about using a dummy save button on a separate subform. Resize this
subform to the size of the button. When the user clicks on this new subform,
he appears to be clicking the save button. The before update event your other
subform is triggered and the message box appears asking for confirmation.

Not the cleanest solution, I know.

Otherwise, I can only think of working with unbound forms and temporary
tables.
This involves alot of coding and I don't have much experience using these yet.

Sorry.
Thanks for the response. This would trigger a message box even if the user
has clicked the button on the form to save the changes. As such, they'd need
[quoted text clipped - 29 lines]
 
Top