G
Guest
when my user wants to change a valid value in a combobox to another i want
him to have a chance to abort it. i wrote this code so that when the value of
IRB_Number is not zero (0) -- at which point we know that other than the
default of zero is in the control --- then if/when the user picks 'No' from
the msgBox pair of choices, i want the original value to remain in the
control. what seems to be happening is that even when 'No' gets selected, the
new value gets entered into the control.
Private Sub IRB_Number_AfterUpdate()
Dim intAnswr As Integer
If Me.IRB_Number = 0 Then
Me.IRB_Number.Requery
Me.Title.SetFocus
Me.Title = ""
Me.Title.Requery
Else
intAnswr = MsgBox("You are about to change this protocol number from #" &
Me.IRB_Number.OldValue _
& " to #" & Me.IRB_Number & "." & Chr(13) & "This will change it EVERYWHERE
THROUGHOUT the database!" & Chr(13) & "Do you wish to continue?", vbCritical
+ vbYesNo + vbDefaultButton2, "Consider this!!")
Select Case intAnswr
Case vbYes
MsgBox "Remember to change the Title!", vbExclamation, "Important"
Me.IRB_Number.Requery
Me.Title.SetFocus
Me.Title = "None"
Me.Title.Requery
Case vbNo
GoTo Line1
End Select
End If
Line1:
End Sub
him to have a chance to abort it. i wrote this code so that when the value of
IRB_Number is not zero (0) -- at which point we know that other than the
default of zero is in the control --- then if/when the user picks 'No' from
the msgBox pair of choices, i want the original value to remain in the
control. what seems to be happening is that even when 'No' gets selected, the
new value gets entered into the control.
Private Sub IRB_Number_AfterUpdate()
Dim intAnswr As Integer
If Me.IRB_Number = 0 Then
Me.IRB_Number.Requery
Me.Title.SetFocus
Me.Title = ""
Me.Title.Requery
Else
intAnswr = MsgBox("You are about to change this protocol number from #" &
Me.IRB_Number.OldValue _
& " to #" & Me.IRB_Number & "." & Chr(13) & "This will change it EVERYWHERE
THROUGHOUT the database!" & Chr(13) & "Do you wish to continue?", vbCritical
+ vbYesNo + vbDefaultButton2, "Consider this!!")
Select Case intAnswr
Case vbYes
MsgBox "Remember to change the Title!", vbExclamation, "Important"
Me.IRB_Number.Requery
Me.Title.SetFocus
Me.Title = "None"
Me.Title.Requery
Case vbNo
GoTo Line1
End Select
End If
Line1:
End Sub