Add Next sequence Grp Number to a query

BBBryan

Registered User.
Local time
Today, 12:12
Joined
Nov 13, 2010
Messages
122
Hi,
I have Access 2010.
I am looking for a function for a query that will have a group number and then the next group number is a sequence group number as
follows:
Table1
Function:
Col1 Col2 GrpSeqNo
3100-E-001 a 1
3100-E-001 b 1
3100-E-001 C 1
4200-v-001 a 2
4200-v-001 b 2
4467-V-002 a 3
4567-V-001 a 4
5100-E-001 a 5
3100-E-001 b 5
And so on.......
Any help with this greatly appreciated.
I was tring this and it is not quite right-
GrpSeqNo: DCount("*", "[Table1]", "[Col1] <= " & [Col1] & " AND [Col2] <= " & [Col2] & "'")+1

Any help with this greatly appreciated.
BBryan
 
The term 'Next' implies an order. I can't discern any order from your data, especially since the last row of sample data has the same Col1 value as the first 3 rows of sample data.

Can you tell me exactly when an new group sequence number should be used? Also, you can only use order words ("next", "first", "last", "previous") if you explicitly tell me how you are ordering your data.
 
The term 'Next' implies an order. I can't discern any order from your data, especially since the last row of sample data has the same Col1 value as the first 3 rows of sample data.

Can you tell me exactly when an new group sequence number should be used? Also, you can only use order words ("next", "first", "last", "previous") if you explicitly tell me how you are ordering your data.

Code:
[FONT=Courier New]I have found a pattern that explains every line except the last (see below).  Using these rules, I believe the the last line would read as follows:  
[LIST]
[*][FONT=Courier New]3100-E-001     a      5[/FONT]
[/LIST]Since it does not I still do not have a clear idea of what the OP really wants, and assume that further explanation will be required.
[LIST]
[*][/FONT][FONT=Courier New]GrpSeqNo increases each time a line has a different value in Col1 than the previous line.[/FONT]
[*][FONT=Courier New]Col2 increases each time a line has the same value in Col1 as the previous line.[/FONT]
[/LIST]
 
Last edited:
Code:
[FONT=Courier New]I have found a pattern that explains every line except the last (see below).  Using these rules, I believe the the last line would read as follows:  
[LIST]
[*][FONT=Courier New]3100-E-001     a      5[/FONT]
[/LIST]Since it does not I still do not have a clear idea of what the OP really wants, and assume that further explanation will be required. [/FONT]
[LIST]
[*][FONT=Courier New]GrpSeqNo increases each time a line has a different value in Col1 than the previous line.[/FONT]
[*][FONT=Courier New]Col2 increases each time a line has the same value in Col1 as the previous line.[/FONT]
[/LIST]
[Reply]
I made a reply on the previous thread for this. It doesn't show up Here I don't know why??
But
Sorry I made a mistake on this number it should have been
6100-E-001    a     5
 
Col1 - Piece of Equipment No in ascending order
 
Col2 - The letter is how many different items I have for Column1 (for each of the same numbers It may or maynot have more than 1 item)
 
col3 Is where I want the query to asign a samegrp no for the same number (col1) and increment by one for the next groupNo. Col2 is the count of how many items that are in Col1.
 
Thanks BBryan
 

Users who are viewing this thread

Back
Top Bottom