Count of records on subform inside a tab

G

Guest

I have two subforms, each inside a single tab control (one tab for each
subform).

I'm trying to count the records on those subforms so I can determine to
'disable' a tab when the subform has no records returned.

I can't get the subforms to count their records when none are returned. I
get a blank field, but the field isn't equal to 0, null, empty or "".

Anyone know what's going on?
 
M

Marshall Barton

Robert_L_Ross said:
I have two subforms, each inside a single tab control (one tab for each
subform).

I'm trying to count the records on those subforms so I can determine to
'disable' a tab when the subform has no records returned.

I can't get the subforms to count their records when none are returned. I
get a blank field, but the field isn't equal to 0, null, empty or "".


I don't think using a text box control with the expression
=Count(*) can be used in VBA code because control expression
calculations are done asynchronously. I.e. your test code
might run before the calculation is done.

It's not clear where/when you want to disable the tab, but
I'll guess it would be in the main form's Current event:

Me.tabctl.Pages(x).Enabled = _
Me.subformcontrol.Form.RecordCount > 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top