Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2005

Tip: Looking for answers? Try searching our database.

forms and recordcount

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Patrick Stubbin - 03 May 2005 00:45 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
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.