add text to textbox based on  value chosen in optionbox

Fordraiders
Fordraiders used Ask the Experts™
on
add text to textbox based on  value chosen in optionbox
frame210 = frame optionbox
option212 = no
option214 = yes
REASON_FOR_ESCALATION =  textbox entry

If the option "Yes" = true then allow entry into textbox REASON_FOR_ESCALATION
if option "No"  = true then  REASON_FOR_ESCALATION.Enabled =  FALSE AND default Text =  "Seller Did Not Provide"

i cant get the sequence correct to do one or the other.

The MsgBox is just an extra caution that they are overwriting data in the box.


Private Sub Option212_GotFocus()
' Is this a business case  NO option
Dim answer As Integer
answer = MsgBox("You are about to override the Text in this box! Do you want to Continue?", vbQuestion + vbYesNo)
 
  If answer = vbYes Then
       ' MsgBox "Yes"
       Me.REASON_FOR_ESCALATION.Enabled = True
      Me.REASON_FOR_ESCALATION.SetFocus
       Me!REASON_FOR_ESCALATION.Text = ""
       Me.Frame210.Value = 2
    Else
       Exit Sub
  End If
  
 End Sub

Private Sub Option214_GotFocus()
' Is this a business case YES option
Dim answer As Integer
answer = MsgBox("You are about to override the Text in this box! Do you want to Continue?", vbQuestion + vbYesNo)
 
  If answer = vbYes Then
       ' MsgBox "Yes"
       Me.REASON_FOR_ESCALATION.SetFocus
       Me!REASON_FOR_ESCALATION.Text = "Seller Did Not Provide"
       Me.Frame210.Value = 1
       Me.REASON_FOR_ESCALATION.Enabled = False
    Else
       Exit Sub
  End If
End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chief Technology Officer
Commented:
Why are you using the Got_Focus event instead of the frame control's OnChange or Afterupdate event.
Use the result of the user's selection and setting of the frame value to run your code, and backout if the user selects to backout.
It'll work perfectly...

Author

Commented:
the frame has no "OnChange" , but did use afterupdate.
Took out the msgbox stuff.. no need for it.

 Private Sub Frame210_AfterUpdate()
' yes
If Me.Frame210.Value = 1 Then
       Me.REASON_FOR_ESCALATION.SetFocus
       Me!REASON_FOR_ESCALATION = "Seller Did Not Provide"
       Me.REASON_FOR_ESCALATION.Enabled = False
Else ' no
        Me.REASON_FOR_ESCALATION.Enabled = True
      Me.REASON_FOR_ESCALATION.SetFocus
       Me!REASON_FOR_ESCALATION = ""
     
End If
     




End Sub

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial