Make Unpopulated Textboxes Invisible

Fran Smith

New member
Local time
Today, 12:23
Joined
Oct 15, 2011
Messages
8
Hi, :)
I'm a newie at VBA, but here goes. The bit after the Else statement is the problem. I did read various other people's threads attempting to make a textbox invisible using the Null statement, but I'm doing it another way - populate else make invisible. This all, of course, works if the field is populated, but sometimes these fields will not be populated. (I'm also going to add to this to link an attachment picture after I get this to work, hense the "attMother" field.

' Populate Mother on the Family Form
Set rst = CurrentDb.OpenRecordset("SELECT ID, Name, Picture, Age, Gender FROM Sims WHERE Gender='Female' AND Age='Young Adult'")
rstCount = rst.RecordCount

If rstCount <> 0 Then
Me.txtMother = rst!Name
rst.Close
Else
Me.txtMother.IsVisible = False
Me.attMother.IsVisible = False
End If

Set db = Nothing
Set rst = Nothing

Why won't the "Me.txtMother.IsVisible = False" part work?

Cheers,
 
Hi Fran Smith,

Try Changing the .isvisible to .visible

the .isvisible is a read only value.

Rich.
 
INstead of
Me.txtMother.IsVisible = False
Me.attMother.IsVisible = False
End If
Suggest you use
Me.txtMother.Visible = False
Me.attMother.Visible = False
End If

Good luck

OOPs, I see I was too slow typing again!!
 
Ah! Thought it must have been something simple! Thanks to you both :-)

Cheers,
 

Users who are viewing this thread

Back
Top Bottom