Solved Sequential Numbering (1 Viewer)

tmyers

Well-known member
Local time
Today, 12:23
Joined
Sep 8, 2020
Messages
1,090
I am not sure what subforum this belong under, so if I got it wrong, I apologize.
On my form, I have a control displaying an items row number (textbox) and for the life of me, I cant figure out how to make the control use the dmax function (if that even is the correct function to use) so for a given ID, the number will always start at 1 and go up. So for JobID 2, you can have rows 1-5 and for JobID 6, you can have rows 1-50. The rows are not related to each other from JobID to JobID, I would just like a nice numbering system for identification.
 

jdraw

Super Moderator
Staff member
Local time
Today, 12:23
Joined
Jan 23, 2006
Messages
15,379
I recommend you post a screen shot and/or mock up of what want.
If you have some code you are using/working with, then please post that as well.

Is this what you are referring to?
 

Auntiejack56

Registered User.
Local time
Tomorrow, 02:23
Joined
Aug 7, 2017
Messages
175
You could also try something like this:

OrderedItems.png


And your SQL in qryItems to produce the ordered item numbers would be this:
Code:
SELECT t.JobID, t.ItemID, t.ItemName, DCount("*","tblItems","JobID = " & [JobID] & " and ItemID<" & [ItemID])+1 AS ItemNumber
FROM tblItems AS t
ORDER BY t.JobID, t.ItemID, DCount("*","tblItems","JobID = " & [JobID] & " and ItemID<" & [ItemID])+1;
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:23
Joined
Feb 19, 2002
Messages
43,266
Here's a sample for generating two types of custom sequence numbers.

 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:23
Joined
May 7, 2009
Messages
19,237
you can use Query as in post #3.
or you can use a custom VBA function to generate the Sequence.
 

Attachments

  • SubNumbering.accdb
    556 KB · Views: 113

tmyers

Well-known member
Local time
Today, 12:23
Joined
Sep 8, 2020
Messages
1,090
Sorry for the late reply!
JDraw, the article you shared seems to be on the right track but not quite what I am after.

Edit for JDraw:
The example the article provided is correct however. Different test that have questions that always start at 1.
Edit #2:
Rereading the article as I dont think I followed it right.

Auntie, same thing. To provide a bit more detail, I am after more or less line numbering. While this isn't a sales system, I more or less am after line numbers. So order 287 has 5 lines numbered 1-5, order 7836 has 20 lines numbered 1-20. More or less just a nice visual numbering system to show how many lines a given job has verse the users inputting the number and messing it up and making it ugly.

Pat, I downloaded the sample and will review in just a moment and report back.

Arnelgp, same as Pat.

Thank you everyone!
 
Last edited:

Auntiejack56

Registered User.
Local time
Tomorrow, 02:23
Joined
Aug 7, 2017
Messages
175
Hmm. The example I gave has 3 jobs (orders), with lines numbered (each starting from 1) in the Item Number column on the extreme right. Seems ok to me.
Jack
 

tmyers

Well-known member
Local time
Today, 12:23
Joined
Sep 8, 2020
Messages
1,090
Hmm. The example I gave has 3 jobs (orders), with lines numbered (each starting from 1) in the Item Number column on the extreme right. Seems ok to me.
Jack
I may have misunderstood it like I did the article JDraw shared. It is early and I havent yet finished my cup of coffee :). I will take a second look.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:23
Joined
May 7, 2009
Messages
19,237
i change the function.
 

Attachments

  • SubNumbering.accdb
    800 KB · Views: 107

tmyers

Well-known member
Local time
Today, 12:23
Joined
Sep 8, 2020
Messages
1,090
I finished my coffee (which was in my Deadpool mug Arnel :giggle:) and Auntie, your query is what I am after. I just apparently had not had enough coffee for full cognitive reading ability to realize that.
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:23
Joined
Sep 21, 2011
Messages
14,270
Didn't see this then?
 

tmyers

Well-known member
Local time
Today, 12:23
Joined
Sep 8, 2020
Messages
1,090
Didn't see this then?
I did, but I will be honest, I did not understand it lol.
Auntie's example was the easiest one for me to follow :)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:23
Joined
Feb 19, 2002
Messages
43,266
That's fine but keep in mind that auntie's solution is not a permanent number. If you add items to the list, the original sequence number might change.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:23
Joined
May 7, 2009
Messages
19,237
just a fair warning. Autonumber fields are long integer.
there was a case when one of the OP here experience having -negative values on them.
it is system generated (therefore we do not have control on what value may come up).
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:23
Joined
Feb 19, 2002
Messages
43,266
You only get negative numbers when the Autonumber is defined as Random rather than Increment. If you are getting them when the Autonumber is defined as Increment, then your seed is broken and you need to fix the table.
 

Users who are viewing this thread

Top Bottom