Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide subform if no data in subform

Status
Not open for further replies.

snuffi01

Technical User
May 24, 2003
26
SE
I have an form with an subform called "Forstasidanaktuellt underformulär".
I want that subform to hide if i dont got anything to show. (if no data in subform then you cant see the subform).
I have tried this from an thread in this sitebut it doesnt work (Select one field in each of the subforms that need to be populated for you to want it to be visible and enter in the OnCurrent event:
If IsNull(SelectedFieldName) Then
Me.SubForm1Name.Visible = False
Else
Me.SubForm1Name.Visible = True
End if
)
Please help me!
 
Hi snuffi01,

Try checking the record count of the subform instead ..

Code:
If Me.
Code:
SubFormControl
Code:
.Form.RecordsetClone.RecordCount = 0 Then
...

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
In the subform properties
in the Data tab
set all the Allows to No

Throw in an "Add New" button and nav controls for when it does show.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top