controll when you save records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to controll when a record is save by use of a controll instead of the
Access default of saving records when you move off theat record. How can I do
this?
 
tjmax said:
I want to controll when a record is save by use of a controll instead of the
Access default of saving records when you move off theat record. How can I do
this?


A full fledged solution to do that would be to make the form
unbound (i.e. blank record source) so there would be no
records to move to. While this is doable, it requires a
**lot** of extra work.

You can use code in your button and the form's BeforeUpdate
event to block a save unless the button is used by using
logic like:

Dim bolAllowSave As Boolean
Private Sub button_Click()
bolAllowSave = True
If Me.Dirty Then Me.Dirty = False 'save record
bolAllowSave = False
End Sub
Private Sub Form_BeforeUpdate(Cancel . . .)
If bolAllowSave = False Then Cancel = True
End Sub

I can't guarantee that this will prevent every possible
automatic save, such as form close, but it should cover the
usual situations.
 
Back
Top