Hiding controls if child/subform has no records.

flect

Registered User.
Local time
Tomorrow, 00:17
Joined
Feb 26, 2008
Messages
86
I have a form with stock report information and a child/subform of a linked table - tblStocktake

the subform is just a standard datasheet view with Master/child linked by ReportID

I have buttons which copy data from a previous report to a new report.

What i'm trying to do is have those buttons only show up when there is No data in tblStocktake (i.e. when I create a new report)

Any ideas on how to do this?

I've a had a go but i'm a bit iffy on the syntax -

Code:
Private  Sub FormCurrent()
If me.child8 is null Then
     me.btnCopy.visible = true
Else
     me.btnCopy.visible = false
End If
End Sub
 
i believe you might actually want this:
Code:
Private  Sub FormCurrent()
If me.child8.form.recordsetclone.recordcount = 0 Then
     me.btnCopy.visible = true
Else
     me.btnCopy.visible = false
End If
End Sub
The recordsetclone.recordcount property of any bound form will give you the current count of the records being displayed (I think). Example - if there is a filter turned on, it will give you a count of the records extracted by the filter only...
 

Users who are viewing this thread

Back
Top Bottom