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

Prevent "save?" prompt on "Save Record" command btn click

Status
Not open for further replies.

sdavison

Programmer
Apr 11, 2001
4
US
Greetings:

I'm using the BeforeUpdate event of a form to check the dirty property in order to prompt the user to ask if they want to save changes. This works fine except that the user gets prompted when the "Save Record" button on the application command bar is clicked. Obviously not necessary...

How can I "filter" out the click event of a button on a custom command bar?

Here's the code I'm using in the BeforeUpdate:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim iAnswer As Integer
Dim ctl As Control
If Me.Dirty Then
iAnswer = MsgBox("save changes?", vbYesNo)
If iAnswer = vbNo Then
Me.Undo
Cancel = True
End If
End If
End Sub

Thanks for any help!!

 
if it's a custom command bar, why not remove that command from it?
 
That might be acceptable, however I can't seem to do anything other than customize it (allow resize, docking, etc).

What I really need is to be able to intercept the click event of the "Save Record" button on that command bar - I have an additional event that I need to initiate upon saving the record.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top