I have a userform which has several textboxes. I want to ensure that user doesn't leave the fields blank. Hence I have a code to check whether text field is blank when user clicks OK cmdbutton.
In the LB_BW_AfterUpdate() event handler, I have following code:
In case a field is left blank I want the userform to stay up and user should be able to correct mistakes or enter text and then click OK again.
However, when looping through the code, when a field is first left blank, code works and user is prompted to enter a value. But when user updates the textbox and clicks OK again, the userform just stays up. It seems at this point that sub is exited already. How do I make it work so that user can enter text in textbox and be able to click Ok again?
Code:
Private Sub cb_OK_Click()
AllClear_Token = False
If LB_BW.Text = "" Then Call LB_BW_AfterUpdate
.....
If AllClear_Token = True Then Unload Input_Parameters
End Sub
In the LB_BW_AfterUpdate() event handler, I have following code:
Code:
Private Sub LB_BW_AfterUpdate()
On Error Resume Next
Select Case CDbl(LB_BW.Text)
Case 1.4
BW = 1.4
Case 3
BW = 3
Case 5
BW = 5
End Select
If Err <> 0 Then
MsgBox "Please select valid Bandwidth"
Input_Parameters.LB_BW.SetFocus
Else
AllClear_Token = True
End If
On Error GoTo 0
End Sub
In case a field is left blank I want the userform to stay up and user should be able to correct mistakes or enter text and then click OK again.
However, when looping through the code, when a field is first left blank, code works and user is prompted to enter a value. But when user updates the textbox and clicks OK again, the userform just stays up. It seems at this point that sub is exited already. How do I make it work so that user can enter text in textbox and be able to click Ok again?