By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,635 Members | 917 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,635 IT Pros & Developers. It's quick & easy.

getting a count on records...what order?

P: n/a
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.OpenRecordset("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.
Jan 11 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Oh man I am stupid..

Set rs = db.OpenRecordset("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 <js******@swbell.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.OpenRecordset("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.
Jan 11 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.