Fran Smith
New member
- Local time
- Tomorrow, 04:15
- 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,

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,