Autonumbering by looking at the last number in the table 
Author Message
 Autonumbering by looking at the last number in the table

I need an auto number function that will look at the last
number in a table and assign that number.  The autonumber
datatype remembers that last number even if the record was
deleted.  Can anyone help?

thanks
john



Wed, 06 Jul 2005 06:59:45 GMT  
 Autonumbering by looking at the last number in the table

Quote:
> I need an auto number function that will look at the last
> number in a table and assign that number.  The autonumber
> datatype remembers that last number even if the record was
> deleted.  Can anyone help?

> thanks
> john

I assume you meant to say "...look at the last number in a table and assign
that number +1".

I use code similar to this in the Form's BeforeUpdate event.

If Len(Nz(Me.ID,""))= 0 Then
    Me.ID = Nz(DMax("ID", "MyTable"),0) + 1
End If



Wed, 06 Jul 2005 09:08:13 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to look for Last Modified Date...

2. See Last Number

3. How do we access the last dialed number from a VBA Routine

4. Getting Table Number of Word Table

5. Wrong week number for last monday

6. Rich Edit - detect number of last line?

7. Get last page number failed with .Net

8. Export of last record in table into file

9. repost: Table Data Last Changed

10. Acc97: Reading last record in a table

11. Detirmine when a table was last altered

12. One for the sages - select last table created

 

 
Powered by phpBB® Forum Software