-
Where am I going wrong? I want bool to pass to sub but I get a "by refrence type mismatch" error.Here's the code:
Public bool as boolean
Private Sub Option1_Click(index As Integer)
If index = 0 Then
Call Pass(bool)
If bool = True Then
frmbool.Show
End If
End If
If index = 1 Then
Call Pass(bool)
If bool = True Then
frmNew.Show
End If
End If
End Sub
Public Sub Pass(bool As Boolean)
If InputBox("Please Enter Your Password") = "password" Then
bool = True
Unload Me
Else
Exit Sub 'Form_Load
End If
End Sub
-
if bool is public then why do you need to pass it to the sub? you can assign it a value any where.
-
I ran your code and it worked fine for me.
-
Just tries running the code as well. Works fine.
-
I would use a function instead of sub