getting a count on records...what order?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sparks

    getting a count on records...what order?

    I have always just got a count on records and put up a box at the top
    of the entry forms saying something like 1 of 500 and updating it as
    you got to 500 of 500.

    I have never thought of this as meaning anything just a reference.

    Now they are wanting it for lookups, even though I have lookup
    pulldowns based on other criteria..
    Well we want to see rec 200 on the report and an easy way to go to
    record 200.
    (I constantly warned them that record number 200 today may NOT bet
    record 200 tomorrow.)

    ok so I just thought about each time I get the count or update it

    Set rs = db.OpenRecordse t("Tblmain")
    count = 0
    rs.MoveFirst
    With rs
    Do Until .EOF
    If Not (IsNull(!AutoID )) Then
    count = count + 1
    End If
    .MoveNext
    Loop
    End With
    rs.Close

    this is just the simple code I was using to count records and I added
    the code
    rs.Edit
    !RecNumber = count
    .Update

    and thought maybe that would work.

    BUT there is a problem
    I thru some numbers in a database for a quick try...deleted some
    records and then ran this and this is what I got

    AutoID person ID RecNumber
    1 93511 8
    2 488393 9
    6 498900 3
    7 494129 4
    8 498725 5
    9 497437 6
    10 500713 7
    11 998323 1


    WHAT in the world or how in the world did I get this.


  • sparks

    #2
    Re: getting a count on records...what order?

    Oh man I am stupid..

    Set rs = db.OpenRecordse t("Tblmain", dbOpenDynaset)

    this works, can someone explain to me or more to them how this won't
    work for reports and them using this info to edit records..I know its
    my fault when some artard can't under stand why this is stupid.


    On Fri, 11 Jan 2008 16:13:16 GMT, sparks <jstalnak@swbel l.netwrote:
    >I have always just got a count on records and put up a box at the top
    >of the entry forms saying something like 1 of 500 and updating it as
    >you got to 500 of 500.
    >
    >I have never thought of this as meaning anything just a reference.
    >
    >Now they are wanting it for lookups, even though I have lookup
    >pulldowns based on other criteria..
    >Well we want to see rec 200 on the report and an easy way to go to
    >record 200.
    >(I constantly warned them that record number 200 today may NOT bet
    >record 200 tomorrow.)
    >
    >ok so I just thought about each time I get the count or update it
    >
    >Set rs = db.OpenRecordse t("Tblmain")
    >count = 0
    >rs.MoveFirst
    >With rs
    Do Until .EOF
    If Not (IsNull(!AutoID )) Then
    count = count + 1
    End If
    .MoveNext
    Loop
    >End With
    >rs.Close
    >
    >this is just the simple code I was using to count records and I added
    >the code
    rs.Edit
    !RecNumber = count
    .Update
    >
    >and thought maybe that would work.
    >
    >BUT there is a problem
    >I thru some numbers in a database for a quick try...deleted some
    >records and then ran this and this is what I got
    >
    >AutoID person ID RecNumber
    >1 93511 8
    >2 488393 9
    >6 498900 3
    >7 494129 4
    >8 498725 5
    >9 497437 6
    >10 500713 7
    >11 998323 1
    >
    >
    >WHAT in the world or how in the world did I get this.
    >

    Comment

    Working...