How to detect if a subform has data or not?

  • Thread starter Thread starter caolan
  • Start date Start date
C

caolan

Guest
I did it with a Report/Subreport, but I can't do it on Form/Subform.

On Report it looks like it:
=Iif([Subreport actperf 1].[Report].[HasData],[Subform actperf 1].[Report]![totaleqs],0)

I tried the same on a Form but it did'nt work¡

Any sugestion?
 
Hi caolan,

there is no HasData in forms or subforms. Therefore you need to go a different way:

Dim rs as DAO.Recordset
set rs=MainFormName.SubFormName.Form.RecordsetClone
rs.MoveLast
MsgBox "There are " & rs.RecordCount & " records in this subform."
set rs=nothing

Mic
 

Users who are viewing this thread

Back
Top Bottom