How can I create a counter for a subset of records within the same table and increment it each time a record is added to the subset?
For example, say that I have a RealEstate table which includes single properties as well as porfolio properties. To distinguish the portfolio properties, there are 2 additional fields: PortName and PortID.
All property records (either type) will have a unique autonumber ID, but what I'm trying to do is create a unique number - PortID - that identifies the portfolio the property belongs to and its sequential number within the portfolio, starting back at zero for each portfolio subset entered.
To complicate things the portfolio properties will be entered via a popup form, activated by a button on the mainform, and the mainform is really a subform of a tab control. (whew..
). In pseudocode, the click event would look something like:
btnAddPortProps_click
initialize count @ 0
increment count to 1
ppropID = [UniqueParentFormData] + count ????
display ppropID in form plus save w/ record
increment count
The counter itself does not need to be global nor stored independently. I just need to temporarily generate a counter value that in conjunction with another form field creates a unique ID that can be saved to each record, and then starts back at zero each time a portfolio is entered.
Can anyone help me figure out how to do this without having to create a separate counter table? Thanks!
For example, say that I have a RealEstate table which includes single properties as well as porfolio properties. To distinguish the portfolio properties, there are 2 additional fields: PortName and PortID.
All property records (either type) will have a unique autonumber ID, but what I'm trying to do is create a unique number - PortID - that identifies the portfolio the property belongs to and its sequential number within the portfolio, starting back at zero for each portfolio subset entered.
To complicate things the portfolio properties will be entered via a popup form, activated by a button on the mainform, and the mainform is really a subform of a tab control. (whew..
![[3eyes] [3eyes] [3eyes]](/data/assets/smilies/3eyes.gif)
btnAddPortProps_click
initialize count @ 0
increment count to 1
ppropID = [UniqueParentFormData] + count ????
display ppropID in form plus save w/ record
increment count
The counter itself does not need to be global nor stored independently. I just need to temporarily generate a counter value that in conjunction with another form field creates a unique ID that can be saved to each record, and then starts back at zero each time a portfolio is entered.
Can anyone help me figure out how to do this without having to create a separate counter table? Thanks!