Results 1 to 2 of 2

Thread: RecordSelectors

  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    RecordSelectors

    Is there a way to produce a record counter that will replace the one that is provided on the form by access?

    I would like turn off the RecordSelecors and NavigationButtons but have a text box that will show the current record number and the total record count.

    Thank for the help.


    Richard Aheron
    raheron@hotmail.com
    Richard

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: RecordSelectors

    Sure. Here's a method I use with unbound forms backed by an ADO recordset.

    <pre>Private mrst As ADODB.Recordset 'holds recordset
    Private mlngRecCount As Long 'count of records in _
    the recordset

    Private Sub SetRecordNum()
    'Reset the "# of #" displayed in the form footer
    [txtRecNum] = CStr(mrst.AbsolutePosition) & " of " & mlngRecCount
    End Sub 'SetRecordNum()</pre>


    mlngRecCount is set in the Form_Open event using the same syntax as with a DAO recordset:

    <pre> .MoveLast
    mlngRecCount = .RecordCount
    .MoveFirst</pre>



    In a bound form with DAO, you can use this:

    <pre>Private Sub Form_Open(Cancel As Integer)
    With Me.RecordsetClone
    .MoveLast
    mlngRecCount = .RecordCount
    .MoveFirst
    End With
    End Sub </pre>


    <pre>Private Sub Form_Current()
    [txtRecNum] = CStr(Me.CurrentRecord) & " of " & _
    mlngRecCount
    End Sub</pre>

    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •