Check if any records exist in subform

virencm

Registered User.
Local time
Today, 20:00
Joined
Nov 13, 2009
Messages
61
Hi

How do i check if any records exist in a subform... if there are records then tick checkbox , else untick.

The code I 'm using doesnt seem to work

Code:
If IsNull(Me.Unissued_material_list_subform) Then
Me.Check92 = 0
Else
Me.Check92 = -1
End If
thanks.
 
Your code fails because you are testing a subform, it's a control this means not null.

You need to test if the recordsource of the form contains records like:
Code:
 If Me.Unissued_material_list_subform.recordsource.Form.Recordset.RecordCount <> 0 then
 
Last edited:
Fyi: To get the correct name of the subform control, click on the subform ONCE and look in the Property Sheet. If you click on it a second time, it will take you to the form embedded in the subform control.

What you want is the name of the subform control.
 
Thanks Peter, Your solution worked perfectly
 
I had the same question & came across this post. I found the below to work as well:
Code:
Me.Recordset.EOF
I tried that method as I was under impression .RecordCount property might not work if using a certain type of locktype (forward-only)
 

Users who are viewing this thread

Back
Top Bottom