Date Entry on form help

hmho

Registered User.
Local time
Today, 10:30
Joined
Apr 7, 2009
Messages
93
Hi I have form I enter data to the table is there a way to set up so when I'm entering the data in the form it doesn't get save automatically unless I hit save.

Thanks

 
Oh,it is very simple. You establish a botton on the form and write VBA.
 
You don't need a "botton on the form," but you do need VBA code
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not (Me.NewRecord) Then
 If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
  Me.Undo
 End If
Else
 If MsgBox("Would You Like To Save This New Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save This Record ???") = vbNo Then
  Me.Undo
 End If
End If
End Sub

Now when you go to move off a new record, or an edited record, Access will ask if you want to save the record.
 
From Design View for your form, press <Control> + <G> which will take you to the form's code window. Then simply paste the code in and go back to Design View by clicking on the red Access "key" icon and run the form.
 

Users who are viewing this thread

Back
Top Bottom