View Single Post
  #2 (permalink)  
Old May 16th, 2006, 02:21 PM
JAnthony JAnthony is offline
Registered User
 
Join Date: Apr 2006
Location: Memphis, TN, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is a way I've handled this in the past with this Function routine.....

    Dim strSS As String
    Dim ItmNum As Integer
    Dim db As Database
    Dim recS As Recordset

    strSS = "SELECT [" & strTable & "].LineNumber " & _
            "FROM [" & strTable & "] " & _
            "ORDER BY [" & strTable & "].LineNumber DESC"

    Set db = CurrentDb()
    Set recS = db.OpenRecordset(strSS, dbOpenDynaset)

    If recS.RecordCount > 0 Then
        With recS
            .MoveFirst
            ItmNum = .Fields("LineNumber")
        End With
    Else
        ItmNum = 0
    End If

    ItmNum = ItmNum + 1

    LineNumbering = ItmNum


John