Unable to undo bound combo box

G

Graham

Haven't worked with Access for some time & this forum is so helpful.

I have a for & 2 sub-forms - sfContacts is for data entry and sfContacts3 is
datasheet view. They are linked in OnLoad of fContacts with
Set Me.sfContacts.Form.Recordset = Me.sfContacts3.Form.Recordset

One of the controls on sfContacts is a bound combo box.

If the user has already selected an enty in this combo box & then changes to
one particular entry, I need confirmation that they really wish to apply that
change.

In BeforeUpdate of the combo box I use MsgBox with vbYesNo and if the
response is not vbYes then the process is
Me.cbEnqID.Undo

While the program definitely gets to that line, the change is not undone.

Using Access 2002
 
M

Marshall Barton

Graham said:
Haven't worked with Access for some time & this forum is so helpful.

I have a for & 2 sub-forms - sfContacts is for data entry and sfContacts3 is
datasheet view. They are linked in OnLoad of fContacts with
Set Me.sfContacts.Form.Recordset = Me.sfContacts3.Form.Recordset

One of the controls on sfContacts is a bound combo box.

If the user has already selected an enty in this combo box & then changes to
one particular entry, I need confirmation that they really wish to apply that
change.

In BeforeUpdate of the combo box I use MsgBox with vbYesNo and if the
response is not vbYes then the process is
Me.cbEnqID.Undo

While the program definitely gets to that line, the change is not undone.

Using Access 2002


Did you remember to set the BeforeUpdate event procedure's
Cancel argument to True?
 
G

Graham

Thanks Marshall

That did the trick.

All too easy when one knows what to do.

Thanks again
 
Top