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

Saving records...

Status
Not open for further replies.

Mbri

Programmer
Jul 8, 2003
6
Is there any way to make access only save a record when someone clicks on the save command button. We're trying to eliminate the autosave/autoupdate feature so that records aren't altered accidentally.
 
You will need a boolean flag in your form module. e.g.
Code:
Dim CanSave As Boolean

Private Sub cmdSave_Click()
CanSave = True
If Me.Dirty Then Me.Dirty = False 'Forces an update
CanSave = False
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)
Cancel = Not CanSave
End Sub

Private Sub Form_Load()
CanSave = False
End Sub
 
The example is great but is the "If" statement correct. There is no "end if" ???
Also is Me.dirty suppose to = somthing before you make it equal to false.

EX: IF Me.Dirty= true then
Me.Dirty=false
End if
Also does Cansave dim as global?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top