=RowNum([form]) problem

B

Bob Waggoner

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
 
J

Jeanette Cunningham

Hi Bob,
it sounds as if the filter of the form has changed between the time you
first look at the row numbering and the time that you go back to that form.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
B

Bob Waggoner

Jeanette,
Your response triggered me to look at two things: I went to the form and
changed auto correct to NO and then ordered the report's sort order on the
field that seemed to be changing. I think that will work.
Thanks!
Bob

Jeanette Cunningham said:
Hi Bob,
it sounds as if the filter of the form has changed between the time you
first look at the row numbering and the time that you go back to that form.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



Bob Waggoner said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top