S
SusanV
Good morning all,
I have a main form (one) with a continuous subform (many). I need to be able
to add an option box to filter the main form to show:
a. All records
b. Only records with associated subform records
c. Only records with NO associated subform records
I'm thinking I can get this via a filter using the subform recordcount, and
I've worked out how to get that info:
Dim i As Integer
i = Me.subfrmTM_HSC.Form.RecordsetClone.RecordCount
Debug.Print i
This returns perfectly the number of associated records in the subform.
How can I apply now use this info to only show records in the main from
where i = 0? I've tried adding a button with the above plus the following
lines:
Me.FilterOn = True
Me.Filter = (i = 0)
This simply returns NO records, although scrolling through the unfiltered
form I know there are dozens of records with 0 in the subform.
I'm sure this can be done, as I've seen posts in the past where someone
needs to find something similar, say customers who have no active orders or
some such.
What am I missing here? Googling has found nothing truly helpful...
TIA,
SusanV
I have a main form (one) with a continuous subform (many). I need to be able
to add an option box to filter the main form to show:
a. All records
b. Only records with associated subform records
c. Only records with NO associated subform records
I'm thinking I can get this via a filter using the subform recordcount, and
I've worked out how to get that info:
Dim i As Integer
i = Me.subfrmTM_HSC.Form.RecordsetClone.RecordCount
Debug.Print i
This returns perfectly the number of associated records in the subform.
How can I apply now use this info to only show records in the main from
where i = 0? I've tried adding a button with the above plus the following
lines:
Me.FilterOn = True
Me.Filter = (i = 0)
This simply returns NO records, although scrolling through the unfiltered
form I know there are dozens of records with 0 in the subform.
I'm sure this can be done, as I've seen posts in the past where someone
needs to find something similar, say customers who have no active orders or
some such.
What am I missing here? Googling has found nothing truly helpful...
TIA,
SusanV