Continuous forms line numbers

  • Thread starter Thread starter AlCamp
  • Start date Start date
A

AlCamp

I need to assign line numbers to each record of a continuous subform?

I'll be numbering from 1 to 125 (or less), and we'll only need to number
every once in a while. There will only be a few users doing this a few
times a day. Speed is not critical

I don't think I'll need a "dynamic", "numbering as I go", system...

Perhaps all the records could be entered without line numbers, and then a
button would line number every record.
or...
After I delete a record, or add a record, I could click the button again,
and all the line numbers would reassign... all over again.

I'm planning to just run a loop using the [CurrentRecord] to assign Record
1... moving to Record 2 and repeating that process, all the way to EOF.

Is this a reasonable way to solve this problem?
Any suggestions or advice on better ways to do this?

Thanks, as always...
Al Camp
 
If the numbers are meaningless in terms of data storage then see:
http://www.lebans.com/rownumber.htm

Rownumber.zip is a database containing functions for the automatic row
numbering of Forms, SubForms and Queries.

Updated Oct. 13 by Allen Browne. Includes error handling and cleaned
code.



Here's an update to the Serialize function by Peter Schroeder:

Good to hear. FWIW, here's the version I came up with today, based off
of your code and Ken's(Getz) suggestion, with a few changes:


Function Serialize(qryname As String, keyname As String, keyvalue) As
Long

Dim rs As Recordset


On Error GoTo Err_Serialize

Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)

rs.FindFirst Application.BuildCriteria(keyname, rs.Fields(keyname).Type,
keyvalue)

Serialize = Nz(rs.AbsolutePosition, -1) + 1


Err_Serialize:

rs.Close

Set rs = Nothing

End Function


Peter Schroeder

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Thanks Stephen,
I should have thought to try your site. I tried the web and the MVP site
with no luck...

I'll definitely give your code a try.

I already am using your GetSetScrollbars on this subform (to keep the
subform from "jumping" during requery)

Thanks again,
Al Camp

Stephen Lebans said:
If the numbers are meaningless in terms of data storage then see:
http://www.lebans.com/rownumber.htm

Rownumber.zip is a database containing functions for the automatic row
numbering of Forms, SubForms and Queries.

Updated Oct. 13 by Allen Browne. Includes error handling and cleaned
code.



Here's an update to the Serialize function by Peter Schroeder:

Good to hear. FWIW, here's the version I came up with today, based off
of your code and Ken's(Getz) suggestion, with a few changes:


Function Serialize(qryname As String, keyname As String, keyvalue) As
Long

Dim rs As Recordset


On Error GoTo Err_Serialize

Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)

rs.FindFirst Application.BuildCriteria(keyname, rs.Fields(keyname).Type,
keyvalue)

Serialize = Nz(rs.AbsolutePosition, -1) + 1


Err_Serialize:

rs.Close

Set rs = Nothing

End Function


Peter Schroeder

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


AlCamp said:
I need to assign line numbers to each record of a continuous subform?

I'll be numbering from 1 to 125 (or less), and we'll only need to number
every once in a while. There will only be a few users doing this a few
times a day. Speed is not critical

I don't think I'll need a "dynamic", "numbering as I go", system...

Perhaps all the records could be entered without line numbers, and then a
button would line number every record.
or...
After I delete a record, or add a record, I could click the button again,
and all the line numbers would reassign... all over again.

I'm planning to just run a loop using the [CurrentRecord] to assign Record
1... moving to Record 2 and repeating that process, all the way to EOF.

Is this a reasonable way to solve this problem?
Any suggestions or advice on better ways to do this?

Thanks, as always...
Al Camp
 
Back
Top