I am unable to refer to a variable in an IIF statement.
Here is what I have done. I declared the variable in a module.
Public strUnused As String
I set it to True when the form opens.
strUnused = True
After a combo is run it is set to False
Sub Combo247_AfterUpdate()
strUnused = False
The form uses If/End If code.
Private Sub Combo15_AfterUpdate()
If strUnused = True Then
Command12.Visible = False
Else
Command12.Visible = True
End If
End Sub
strUnused works perfectly in the above code.
Now, the problem.
I created a Text Box and for Control Source I used an IIF statement.
=IIf([strUnused]=True,"A","B")
The Text Box shows an error - #Name?
I put quotes around True.
=IIf([strUnused]="True","A","B")
The Text Box still shows the error - #Name?
I try to remove the square brackets but they keep coming back in.
=IIf(strUnused=True,"A","B")
I would appreciate it if someone can tell me how to refer to this variable in the IIF statement.
Thank You!!