Confirm record changes checked. Why no confirmation messages?

G

Guest

ACC 2000, ACC 2003: Even though Tools>Options>Edit/Find>Confirm Record
Changes is checked, I receive no confirmation message when I make changes to
a record and save the changes by moving to another record. Why not?
 
J

John Vinson

On Sun, 6 Nov 2005 09:16:06 -0800, "Steve Ginzbarg" <Steve
ACC 2000, ACC 2003: Even though Tools>Options>Edit/Find>Confirm Record
Changes is checked, I receive no confirmation message when I make changes to
a record and save the changes by moving to another record. Why not?

Because the Option refers to confirmations if you run an Update Query
or another query which modifies table data, not for changes made
manually in a datasheet or a Form.

The assumption is that if you're looking at data on a form and choose
to change it, that you want to do so; and that users would be annoyed
at getting a prompt for every single record that they edit.

If you want a prompt to appear on a Form, use the Form's BeforeUpdate
event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
iAns = Msgbox("Are you sure you want to change this record?", vbYesNo)
If iAns = vbNo Then
Cancel = True
End If
End Sub

If you want a prompt to arise when you open a table datasheet and edit
it... you're out of luck; table datasheets don't provide any usable
events for this purpose.

John W. Vinson[MVP]
 
G

Guest

Hi John

What if I don't want to save the change and close the form.

This is my code, when I click No, it doesn't closed the form

Private Sub Save_Exit_Click()
On Error GoTo Err_Save_Exit_Click

Dim iAns As Integer
iAns = MsgBox("Are you sure you want to change this record?", vbYesNo)
If iAns = vbNo Then
Cancel = True

Else

DoCmd.Close
End If
end sub
 
D

Douglas J Steele

You're only calling DoCmd.Close if the user doesn't select No.

The Cancel in that event, though, will not do anything. The only place
Cancel makes a difference is in the BeforeUpdate, BeforeInsert or Unload
events.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top