Subform to disappear depending on whether it contains data.

LOUISBUHAGIAR54

Registered User.
Local time
Today, 10:47
Joined
Mar 14, 2010
Messages
157
How do i set a subform to appear/ disappear on whether the subform contains/ does not contain records ?
 
Lets say your subform contains the orders of your Clients. I would put the below in the form's Current event.

Code:
If dlookup("count(*)","Orders","ClientID = " & me.ClientID) = 0 then
    me.OrdersSubform.visible = false
else
    me.OrdersSubform.visible = true
End if
 
I have much less experience than many of the people replying here, but when I want a field or a subform not to appear if there's nothing there, I've always set the "Can Shrink" property on the Format tab of the Properties to "Yes."

There may be instances where this won't work, but it has worked for me.
 
I like both replies. I have tried to set can grow and can shrink properties to the subform to yes, but the form still show with no data.

The DLookUp option is more promising and I will try it. Could you explain the function to me and how it works please.

LouisB
 

Users who are viewing this thread

Back
Top Bottom