hiding sub forms with no records in it

anglesgal

Registered User.
Local time
Today, 04:06
Joined
Mar 9, 2003
Messages
10
Hi. can you help me? im in urgent need of help. im trying to hide a sub form within a form if there are no records present. i got the code off a diff site here but i cant find it now. :( anyway, this was the code-

Private Sub Form_Current()
With Me![SubformName].Form
.Visible = (.RecordsetClone.RecordCount > 0)
End With
End Sub

i added my details but im not sure what to do with the (.RecordSetClone.) part. i left it as it is but it came back as an error. any ideas? Am I supposed to add something different to it?
 
if you've replaced [SubformName] with the actual subform name, then it should work for you.

The code looks at the results in form's recordsource(RecordsetClone) and sets the visible property to true or false depending on the number of records returned.
 
your right, it was my sub form name that i had wrong. thanks.
 

Users who are viewing this thread

Back
Top Bottom