SteveL13
asked on
How add a field with sequential numbers to a form
I have a form that is a continuous form. I want to add a field to the form that just shows a number that is not bound to the record source.
The first record would show "1", the second record would show "2", etc. Is there a way to do this?
The first record would show "1", the second record would show "2", etc. Is there a way to do this?
ASKER
The purpose is just to show the records as 1, 2, 3, etc. No relationship to the PK. So DCount("*", "PK < " & PK) +1 won't work. The PK numbers are not sequential.
Unless you can utilize the actual sort sequence AND it is UNIQUE, then you won't be able to assign a sequential number. How are the rows sorted? Try concatenating the sort fields and using that to determine the count of earlier records.
the key is "that just shows a number that is not bound to the record source."
CAN you modify the structure? If so you could add:
TempRecNum, Long Integer, Default Value =Null
This temporary field could be updated as necessary.
While there is a way to use code to add a number to show as a "record number", it could recalculate and throw values off as the user moves if there is no way to bind it to values in the table.
CAN you modify the structure? If so you could add:
TempRecNum, Long Integer, Default Value =Null
This temporary field could be updated as necessary.
While there is a way to use code to add a number to show as a "record number", it could recalculate and throw values off as the user moves if there is no way to bind it to values in the table.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Gustav often has great solutions -- this, however, was already suggested by Pat. But he gave code with usage examples ...
bottom line is this:
if there is a sort key that is unique, code can be used that ties the sort key to values in the table.
bottom line is this:
if there is a sort key that is unique, code can be used that ties the sort key to values in the table.
This is quite easy to do with a report because the recordset isn't "live" and can't be sorted without rerunning the entire report.