Results 1 to 2 of 2
Thread: ? RE: unique identifier (2002)
2003-06-11, 14:50 #1
- Join Date
- Jun 2003
- Thanked 0 Times in 0 Posts
? RE: unique identifier (2002)
okay, hopefully this is not as stupid a question as i think it is. i am relatively new to using access, and while i think i understand the very basics, i know i have much to learn. here's my question: i am designing a database for time accounting. i have a table for clients and a table for input of hours (input). for each input record, i want to automatically assign a sequence number which is sequential, and is unique to the client. can somebody walk me through that? and i mean really walk me through it, because while i read some of these posts about using dmax and such, i'm not sure where to enter that.
thanks from a hopefully not too stupid person.
2003-06-11, 18:46 #2
- Join Date
- Jun 2001
- Crystal Beach, FL, Florida, USA
- Thanked 36 Times in 35 Posts
Re: ? RE: unique identifier (2002)
I'm assuming you want to assign sequential numbers for each clients entries; that is, each client will have entries with sequence numbers 1,2,3,4, etc.
Without passing any comment on what it is you are doing, this function will find the next sequence number for a client. Put it in your form's Before Update event (but use an IF statement so it only gets execute if this is a new record):
txtSeqNo = nz(DMax("SeqNo","tblHours","ClientID=" & txtClientID), 0) +1
In above, txtSeqNo and txtClientID are controls on your form holding values from table SeqNo and ClientNo respectively.