Insert this code in the form's (or report's) code module:
(Assuming that the form is bound to a table or query and assuming that
the field myfieldname is bound to a field in the table by the same
name:
example - you have a table named Contacts and in that table you have a
field named LastName. The form is bound to the table Contacts and the
field ypu want to hide or show is named LastName and is bound to the
field LastName in the Contacts table.)
Private Sub Form_Load()
If len(me!myfieldname) > 0 then
me.myfieldname.visible = true
me.mylabelname.visible = true
Else
me.myfieldname.visible = false
me.mylabelname.visible = false
End If
End Sub
Also to avoid having the field flicker when the form loads, set the
visible property of the field and the label to false so that it loads
hidden but then is made visible only if it is full.
kingphil...@yahoo.com wrote:
Can someone help me with some code to make a text box and lable
visible only if the field in the table has something in it?
Thanks