Full Version: Line Counter
UtterAccess Forums > Microsoft® Access > Access Forms
Doran
I am creating an order entry continuouse form. What is the best was to add a line counter, i.e.,
ine Counter Qty Product Price
1 6 WidgetA 1.25
2 4 Hoola Hoop 3.25
3 1 Sctoch Tape 2.75
ect.
Many thanks,
Doran
theDBguy
Probably, the best way would be to add it in the query. For example:
ELECT
(SELECT Count(*)
FROM YourTable
WHERE ID <= T.ID) As Counter,
*
FROM YourTable As T
The above assumes that you have an autonumber PK and that your data is sorted on the ID or not sorted at all.
Hope that helps...
Doran
Is there a way to construct it in Design View?
any thanks,
Doran
theDBguy
You can try something like this:
On design view, right click the table and go to properties. Give it an alias name of T.
Then in the first column, type something like this:
Counter: (SELECT Count(*) FROM YourTable WHERE ID <= T.ID)
Note: I don't have time to test this right now, so I hope it works for you. Also, make sure the field and table names reflect your actual object names.
Hope that helps...
Doran
Thank you very much for your help. I really appreciate it.
oran
theDBguy
You're welcome. Good luck with your project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.