Generate restarting autonumber (1 Viewer)

dark11984

Registered User.
Local time
Today, 20:19
Joined
Mar 3, 2008
Messages
129
I need to design a table or query that can be exported to excel then copied into a write protected upload spreadsheet.

The fields in the upload spreadsheet are:
Order#
Sequence#
SKU
Qty

The sequence number is 1, 2, 3 , etc for each SKU then restarts at each new order #.

I can't figure out how to assign the sequence number in my query or table before exporting it.

Any help would be much appreciated. Thanks.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:19
Joined
Feb 19, 2013
Messages
16,723
simplest way in your query is to use the dcount method so perhaps something like

sequence: dcount("*","myTable","Order=" & Order & " AND SKU<=" & SKU)

assumes your SKU is a numeric value, if it is text then use
sequence: dcount("*","myTable","Order=" & Order & " AND SKU<='" & SKU & "'")

you will need to order your query by Order, SKU

Note using non alphanumeric characters such as # is not recommended, you can get unexplained errors
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:19
Joined
Feb 19, 2002
Messages
43,686
If you need the sequence to be permanent, you need to assign it when the record is added. Here's a sample that shows how to create two kinds of sequence numbers.

 

Users who are viewing this thread

Top Bottom