G
Guest
Hi All,
I have an issue with an If statement.
The scenario:
for a current client, the user double clicks a client namein a listbox - the
client file opens. Fields on the form are visible according to client type.
Create an new client, open form called clienttype select type from option
frame, on click open client form in dataentry mode with fields hidden or
visible according to client type.
The problem:
On execution of the code, the open new client scenario works, however
opening an existing client has an error 94 message "invalid use of null". I
tried to get around it with a GoTo statement but it hasn't helped. The error
is occuring immediately after the End If statement. What should I have in my
syntax if the form is to load without the clienttype form being open?
Private Sub Form_Load()
If CurrentProject.AllForms(ClientType).IsLoaded Then
If Forms!ClientType.Frame1 = 2 Then Me.Check109.DefaultValue = True Else
Me.Check109.DefaultValue = False
Else: GoTo 100
End If
100
Me.Combo85.Visible = (Check109 = False)
Me.DOB.Visible = (Check109 = False)
Me.FirstName.Visible = (Check109 = False)
Me.MiddleNames.Visible = (Check109 = False)
Me.LastName.Visible = (Check109 = False)
Me.Text113.Visible = (Check109 = True)
End Sub
I have an issue with an If statement.
The scenario:
for a current client, the user double clicks a client namein a listbox - the
client file opens. Fields on the form are visible according to client type.
Create an new client, open form called clienttype select type from option
frame, on click open client form in dataentry mode with fields hidden or
visible according to client type.
The problem:
On execution of the code, the open new client scenario works, however
opening an existing client has an error 94 message "invalid use of null". I
tried to get around it with a GoTo statement but it hasn't helped. The error
is occuring immediately after the End If statement. What should I have in my
syntax if the form is to load without the clienttype form being open?
Private Sub Form_Load()
If CurrentProject.AllForms(ClientType).IsLoaded Then
If Forms!ClientType.Frame1 = 2 Then Me.Check109.DefaultValue = True Else
Me.Check109.DefaultValue = False
Else: GoTo 100
End If
100
Me.Combo85.Visible = (Check109 = False)
Me.DOB.Visible = (Check109 = False)
Me.FirstName.Visible = (Check109 = False)
Me.MiddleNames.Visible = (Check109 = False)
Me.LastName.Visible = (Check109 = False)
Me.Text113.Visible = (Check109 = True)
End Sub