save button notification

Ravi Kumar

Registered User.
Local time
Today, 21:25
Joined
Aug 22, 2019
Messages
162
form my save a button I have written the below to show a notification & then save code but it is not working , pls suggest me the correct code:
Private Sub cmdsave_click()
If Me.Dirty = True Then
If MsgBox("Do you want to save the changes for this record?", _
vbYesNo + vbQuestion, "Save Changes?") = vbNo Then
Me.Undo
End If
End If
End Sub
 
Hi. What does "is not working" mean? What is actually happening when you click the button?
 
it is not saving any changes & not displaying new record..
 
Code:
Private Sub cmdsave_click()
   If Me.Dirty = True Then
      If MsgBox("Do you want to save the changes for this record?", _
         vbYesNo + vbQuestion, "Save Changes?") = vbNo Then
         Me.Undo
[COLOR="Purple"]      Else
         Me.Dirty = False
[/COLOR]      End If
   End If
End Sub
 
dear sir ,
it is saving but it is showing new record after saving,

Private Sub cmdsaveandnew_Click()
If Me.Dirty = True Then
If MsgBox("Do you want to save the changes for this record?", _
vbYesNo + vbQuestion, "Save Changes?") = vbNo Then
Me.Undo
Else
Me.Dirty = False
End If
End If
End Sub
 
PMFJI,

I expect you will be posting a lot of code in the future.

Please consider using the code tags # to show your code with decent indentation.

Just like arnelgp posted back to you.

That way you help others to help you.

dear sir ,
it is saving but it is showing new record after saving,

Private Sub cmdsaveandnew_Click()
If Me.Dirty = True Then
If MsgBox("Do you want to save the changes for this record?", _
vbYesNo + vbQuestion, "Save Changes?") = vbNo Then
Me.Undo
Else
Me.Dirty = False
End If
End If
End Sub
 
First, you complain that it is not displaying a new record...then you complain that it is displaying a new Record...which do you want?

If you want it to move to a new Record...you need to tell Access to go to a new Record:

DoCmd.GoToRecord , , acNewRec

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom