Reset incrementing table field when another field changes
Reset incrementing table field when another field changes
(OP)
Access 2013
I have a table that includes multiple records per account number. I would like to create a field that numbers each record so that every record has a number starting at 1 and increasing by 1 for each record for that account number. For example:
Original Table
RPID-----PropClass
1----------3400
1----------4000
2----------1600
2----------1700
2----------3400
3----------1600
3----------1700
3----------4100
New Table
RPID-----PropClass-----SeqNo
1----------3400----------1
1----------4000----------2
2----------1600----------1
2----------1700----------2
2----------3400----------3
3----------1600----------1
3----------1700----------2
3----------4100----------3
3----------4200----------4
I have a table that includes multiple records per account number. I would like to create a field that numbers each record so that every record has a number starting at 1 and increasing by 1 for each record for that account number. For example:
Original Table
RPID-----PropClass
1----------3400
1----------4000
2----------1600
2----------1700
2----------3400
3----------1600
3----------1700
3----------4100
New Table
RPID-----PropClass-----SeqNo
1----------3400----------1
1----------4000----------2
2----------1600----------1
2----------1700----------2
2----------3400----------3
3----------1600----------1
3----------1700----------2
3----------4100----------3
3----------4200----------4
RE: Reset incrementing table field when another field changes
You can try a query with DCount()
CODE --> sql
Duane
Hook'D on Access
MS Access MVP
RE: Reset incrementing table field when another field changes
RE: Reset incrementing table field when another field changes
CODE --> SQL
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?
RE: Reset incrementing table field when another field changes
You didn't answer my question about the sequence/order. Records are like marbles in a bucket. There is no order. If you want to sequence them, you need to provide the specifications as to which record gets assigned 1 vs 2. If your data doesn't provide this order then you will need to create something.
Did you need to store the resulting calculation or can it be generated dynamically? Does the recordset need to be edited or is it for a report?
Duane
Hook'D on Access
MS Access MVP
RE: Reset incrementing table field when another field changes
taxmanrick,
You didn't answer my question about the sequence/order. Records are like marbles in a bucket. There is no order. If you want to sequence them, you need to provide the specifications as to which record gets assigned 1 vs 2. If your data doesn't provide this order then you will need to create something.
I don't necessarily need them in any order within each RPID, they just need to be in RPID order before numbering.
Did you need to store the resulting calculation or can it be generated dynamically? Does the recordset need to be edited or is it for a report?
Yes I need to store the seq no in the table so that I can use that number for something else
RE: Reset incrementing table field when another field changes
RE: Reset incrementing table field when another field changes
Just a guess...
Have fun.
---- Andy
A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
RE: Reset incrementing table field when another field changes
RE: Reset incrementing table field when another field changes
CODE --> sql
Duane
Hook'D on Access
MS Access MVP
RE: Reset incrementing table field when another field changes
RE: Reset incrementing table field when another field changes
Something like this ?
CODE --> SQL
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?