Jimmy Stewart wrote:
I have a calculated control "ContactInfo" on my form ... ="Attn: " &
[Contact]
In the OnCurrent event for the form I have the following code...
If Me.Contact Is Null Then
Me.ContactInfo.Visible = False
End If
The idea is, that if there is no contact listed (I have the contact
field on the form with visible property set to no) then this line
will not display. When I run the form I get error 'Runtime Error 424'
Object required. What gives.
"Is Null" is valid in SQL, but not in VBA code. In VBA code you need to use
the IsNull() function. You also have no way to make the control visible again
once it is made invisible.
If IsNull(Me.Contact) Then
Me.ContactInfo.Visible = False
Else
Me.ContactInfo.Visible = True
End If
Since IsNull() returns a True/False the above can be shortened to...
Me.ContactInfo.Visible = Not IsNull(Me.Contact)
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com