Hello, friends!

I have 2 sheets, like front end and back end.

In db sheet, there's a table with a field I need to autonumbering. Actually, I did it and it works, but I'm not sure if the best way, cause it can may be making the adding record query a litle slow.

I did it in two steps:

#1 - Query for get the last id field value then put into a variable plus 1.

strSQL = "SELECT * FROM [tbltramitacao$]"
        Set rs = cn.Execute(strSQL)
        If rs.RecordCount = 0 Then
            IDcod = 1
        Else
            rs.MoveLast
            IDcod = rs.Fields(0)
            IDcod = IDcod + 1

#2 - Adding Record Query

Is there a optimized way to do it?

Thank's for help!

[]'s