A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

=RowNum([form]) problem



 
 
Thread Tools Display Modes
  #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
  #2  
Old August 11th, 2009, 09:57 PM posted to microsoft.public.access.tablesdbdesign
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default =RowNum([form]) problem

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" wrote in message
...
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



  #3  
Old August 12th, 2009, 03:46 PM posted to microsoft.public.access.tablesdbdesign
Bob Waggoner[_2_]
external usenet poster
 
Posts: 80
Default =RowNum([form]) problem

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" wrote:

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" wrote in message
...
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




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.