View Single Post
  #1  
Old August 11th, 2009, 05:45 PM posted to microsoft.public.access.tablesdbdesign
Bob Waggoner[_2_]
external usenet poster
 
Posts: 80
Default =RowNum([form]) problem

Our slit check database - (we check the slit widths on material running
through our machine) we have the form set up so that numbering is handled by
the =RowNum([form]) function. Code is from Stephen Lebans (C) 1999. It was
updated by Chris Bergmans...
Public Function RowNum(frm As Form) As Variant
On Error GoTo Err_RowNum
'Purpose: Numbering the rows on a form.
'Usage: Text box with ControlSource of: =RowNum([Form])

With frm.RecordsetClone
.Bookmark = frm.Bookmark
RowNum = .AbsolutePosition + 1
End With

Exit_RowNum:
Exit Function

Err_RowNum:
If Err.Number 3021& Then 'Ignore "No bookmark" at new row.
Debug.Print "RowNum() error " & Err.Number & " - " & Err.Description
End If
RowNum = Null
Resume Exit_RowNum
End Function

My problem is, if I leave the record and go back to it later, the records
are scrambled - not the numbering - that still is 1-10, for example, but the
records associated with that row number have moved. Record 1 might be record
3 or 4 now.

How do I keep this from happening? It started when we converted from Access
97 to Access 2003.

Help, please!
Bob