Question : Adding a new record and assigning the next number in the sequence

Hi experts,

I have a form based on a table.  In the table the data looks like this:

Sequence     Name      Description
-----------      ------      -------------

1.1.1            Name 1    Description 1
1.1.2            Name 2    Description 2
1.1.3            Name 3    Description 3
1.1.4            Name 4    Description 4

The sequence is not an autonumber.

When I click on the Add button on the form, is it possible for the sequence field to be displayed with the next number?  For example, if the last records sequence was 1.1.4, by pressing the add button, could this new record automatically have assigned to it 1.1.5?

I would have used an autonumber, but if I delete record 1.1.4 from the above example, when I next click on the Add button, I need the sequence field to display (and store) 1.1.4.

If I can explain further, please let me know.

Regards and thank you for your help in advance,
Terry

Answer : Adding a new record and assigning the next number in the sequence

dmv=DMax("Sequence","MyTable")                              ' yields 1.1.4
pref=left(dmv,instrrev(dmv,"."))                                   ' yeilds 1.1.
newval=Pref & CInt(Mid(dmv,instrrev(dmv,".")+1))+1    ' yields 1.1.5
-----------------^-----------to here------------------^--      ' yields 4
Random Solutions  
 
programming4us programming4us