How do i determine the number of records in the underlying table/query in an
open form and then force a particular field to be either visible (or not) if
the number of records is > 1
i am using the 'on current event' property to set this.
if have tried combination of below without success:
' Me.[Combo7].Visible = (.RecordsetClone.RecordCount > 1)
'Me![Combo7].Visible = (.record.RecordCount > 1)
'With Me![Combo7]
'.Visible = (rsa.RecordCount > 1)
' End With

Signature
Regards
Patrick Stubbin
Rob Parker - 03 May 2005 02:30 GMT
The easiest way is probably:
Me.[Combo7].Visible = (DCount("*", Me.RecordSource) > 1)
Note: If you do want/need to use RecordsetClone, the RecordCount won't be
accurate until you moved to the last record.
HTH,
Rob
> How do i determine the number of records in the underlying table/query in an
> open form and then force a particular field to be either visible (or not) if
[quoted text clipped - 7 lines]
> '.Visible = (rsa.RecordCount > 1)
> ' End With
Patrick Stubbin - 03 May 2005 02:58 GMT
thankyou

Signature
Regards
Patrick Stubbin
> The easiest way is probably:
>
[quoted text clipped - 20 lines]
> > '.Visible = (rsa.RecordCount > 1)
> > ' End With
Marshall Barton - 03 May 2005 02:31 GMT
>How do i determine the number of records in the underlying table/query in an
>open form and then force a particular field to be either visible (or not) if
[quoted text clipped - 7 lines]
> '.Visible = (rsa.RecordCount > 1)
> ' End With
Rather than the Current event, which executes as you
navigate from record to record. Try using the Load event
and right after any Requery statements you may have.
With Me.RecordsetClone
.MoveLast
Me.[Combo7].Visible = (.RecordCount > 1)
End With
The MoveLast is critical since the RecordCount property only
tells you how many records have actually been accessed so
far, frequently just 1. The MoveLast accesses all the
records, so RecordCount will reflect all the records in the
form's record source.

Signature
Marsh
MVP [MS Access]
Patrick Stubbin - 03 May 2005 02:58 GMT
thankyou

Signature
Regards
Patrick Stubbin
> >How do i determine the number of records in the underlying table/query in an
> >open form and then force a particular field to be either visible (or not) if
[quoted text clipped - 22 lines]
> records, so RecordCount will reflect all the records in the
> form's record source.