The situation is that I have a userform namely "accounts". Within it, I have a button"A" to trigger another userform namely "account selection".
In the "account selection", I have the "accountok" button to trigger the following code. Previously, when I click the "accountok", I will only unload my second userform. But under the
situation I didnt change the code, some problems happen. When I am opening the Visual Basic Window, I click the "accountok" button, it will directly close my second and first userform at the same time(i.e
close all things). But if I close the Visual Basic Window, the code funtions properly. (Although I dont think it is related to my code below) Anyone can help? Please
Private Sub accountok_Click()
Dim var As String
var = ""
If Me.CheckBox1.Value = True Then
var = "BY"
End If
If accountform.selectclick = "selectclick1" Then
accountform.TextBox1 = var
ElseIf accountform.selectclick = "selectclick2" Then
accountform.TextBox2 = var
ElseIf accountform.selectclick = "selectclick3" Then
accountform.TextBox3 = var
ElseIf accountform.selectclick = "selectclick4" Then
accountform.TextBox4 = var
ElseIf accountform.selectclick = "selectclick5" Then
accountform.TextBox5 = var
End If
Unload accountselection
End Sub
In the "account selection", I have the "accountok" button to trigger the following code. Previously, when I click the "accountok", I will only unload my second userform. But under the
situation I didnt change the code, some problems happen. When I am opening the Visual Basic Window, I click the "accountok" button, it will directly close my second and first userform at the same time(i.e
close all things). But if I close the Visual Basic Window, the code funtions properly. (Although I dont think it is related to my code below) Anyone can help? Please
Private Sub accountok_Click()
Dim var As String
var = ""
If Me.CheckBox1.Value = True Then
var = "BY"
End If
If accountform.selectclick = "selectclick1" Then
accountform.TextBox1 = var
ElseIf accountform.selectclick = "selectclick2" Then
accountform.TextBox2 = var
ElseIf accountform.selectclick = "selectclick3" Then
accountform.TextBox3 = var
ElseIf accountform.selectclick = "selectclick4" Then
accountform.TextBox4 = var
ElseIf accountform.selectclick = "selectclick5" Then
accountform.TextBox5 = var
End If
Unload accountselection
End Sub