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

How to undo something

Status
Not open for further replies.

cer5yc

Programmer
Sep 27, 2007
103
US
I have an option group where if the user selectes "no" they get a message box asking if they want to change the value. If they select vbno, I want the option button to go back to the "yes" button. I'm in VBA and can't figure out how to make it do that. The undo operation isn't working. Here's what I have so far - I'm not a programmer so this isn't pretty but it works :) (except for the last part) If anyone would like to offer a better way to write this that would be great also. Thanks!

I need something after if vbNo Then... to make the option group selection go back to "Yes" (opgAutomaticRenewal = 1 instead of 2)

Private Sub opgAutomaticRenewal_BeforeUpdate(Cancel As Integer)
If opgAutomaticRenewal = 2 Then
Dim MsgBox4 As Integer
MsgBox4 = MsgBox("Are you sure? If you select yes, your Automatic Renewal Information will be deleted", vbYesNo)
If MsgBox4 = vbYes Then
txtRenewalPeriod.Value = Null
Dim RenewalDate As Variant
RenewalDate = Null
Dim RenewalNoticeDate As Variant
RenewalNoticeDate = Null
Me.[txtRenewalDate1].Value = RenewalDate
txtRenewalNoticeDate = RenewalNoticeDate
txtRenewalPeriod.Enabled = False
txtRenewalDate1.Enabled = False
txtRenewalNoticeDate.Enabled = False
End If
If MsgBox4 = vbNo Then

End If

End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top