jackie77
Jackie
- Local time
- Today, 12:46
- Joined
- Jul 18, 2007
- Messages
- 85
Hi all
I'm working on a bit of code that before a combobox is changed checks with the user to confirm that they want the change to go ahead, if yes a recorded is added to a table
this all work fine apart from if no is selected - I am trying to get the combobox to undo the change however when you select no the msgbox pops up fine but the combobox does not undo
can't see where I'm going wrong I thought undo worked for comboboxes
Any help would be appreciated
Cheers
Jackie
I'm working on a bit of code that before a combobox is changed checks with the user to confirm that they want the change to go ahead, if yes a recorded is added to a table
this all work fine apart from if no is selected - I am trying to get the combobox to undo the change however when you select no the msgbox pops up fine but the combobox does not undo
can't see where I'm going wrong I thought undo worked for comboboxes

Any help would be appreciated
Cheers
Jackie
Code:
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Do you wish to change the status of this Job? 'Yes' or 'No'.", Buttons:=vbYesNo)
' If Yes button selected
If Response = vbYes Then
Comment = "To: " & Me.StatusTemp1 & " From: " & Me.StatusID.Column(1)
CurrentDb.Execute "INSERT INTO Communication ([CommunicationType],[Date],[JobID], [StaffID], [MethodReportedID], [Notes])VALUES ('24', Now(), " & JobID & ", " & StaffID & ", '6', '" & Comment & "');"
MsgBox "The Status has been changed" & Chr(13) & Chr(10) & " and the record has been updated successfully!"
Else
' If no button was selected.
Me.StatusID.Undo
MsgBox "Status is PLEASE NOTE - The account status has not been changed!!" & Me.StatusID & " " & Me.StatusTemp1 & " " & Me.StatusTemp2
End If
End Sub