Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2003
    Posts
    2

    Unanswered: Manually navigating a form's datasource

    Hi, I have a question. I have created a form with a table as source for it's data. Now I want to know how I can use VB code to navigate through the records in the table, so that they are displayed on the form. So basically what I want is to recreate those little navigation buttons that are placed by default at the bottom of a form.

    I know I can use MoveFirst, MoveNext, MovePrevious etc on Recordsets, but what is the name of the recordset used by the form?

    Any help would be appreciated. Thank you very much.

  2. #2
    Join Date
    Oct 2001
    Location
    Chicago
    Posts
    440
    You want to navigate through your form?
    or
    You want to learn how to navigate through a recordset?

    If it is a form then use the command button wizard to place your navigation buttons on the form - then take a look at the code that is generated.

  3. #3
    Join Date
    Apr 2003
    Posts
    2
    I wanted to navigate through the recordset. The cmdbutton wizard trick helped. Thanks.

  4. #4
    Join Date
    Jun 2003
    Location
    Memphis, TN
    Posts
    13

    I want to do this.. BUT....

    ..I want to display the "rec number" or "total number" Records - type thing.. can I get the current 'record number'.. and more importantly the 'total number' EASILY without having to count? Is there a function in Access to do this? Thanks...

  5. #5
    Join Date
    Oct 2001
    Location
    Chicago
    Posts
    440
    Private Sub Form_Current()
    txtRecordCount = Me.RecordsetClone.RecordCount
    txtCurrentRecord = CurrentRecord
    End Sub


    -Matt

  6. #6
    Join Date
    Sep 2003
    Location
    UK
    Posts
    122

    Re: I want to do this.. BUT....

    Originally posted by Memphis Bill
    ..I want to display the "rec number" or "total number" Records - type thing.. can I get the current 'record number'.. and more importantly the 'total number' EASILY without having to count? Is there a function in Access to do this? Thanks...
    MS Access uses a non accessable method to work out the record count. It waits untill there is a lul in data-access and uses the slack time to count through and get the results. This way you notice no "drag" while waiting for this calculation to be performed.

    My current understanding is that although you can use code such as DCount to get the information (as it is not a datum that is stored anywhere), you will sooner or later notice an iritating slowdown of the database system.

    One work around I saw was an unbound TextBox and a command button labled "Count Records" When pressed the lable became "Re-Count Records" and a DCount was used and the result placed into the TextBox.

    One last point to ask: how vital is it taht the users know how many records there are? If the information is not required you may find yourself with other more pressing matters you could be dealing with. If, on the other hand, the boss demands it (often the case) I'm willing to try and help if you require additional assistance but Rockey's code looks fine at first glance.
    Matt the Hat says: "what!?"
    A child of five could understand this! Fetch me a child of five!
    SCARY HARD CHALLENGE: http://www.dbforums.com/showthread.php?threadid=988682

Posting Permissions

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