T
Tara
I have a continuous subform and I'm trying to make each record displayed
numbered 1, 2, 3, etc. I personally see no use for that - at least in this
situation, but for whatever reason, the user would prefer it. So, I tried
using Stephen Lebans' RowNum solution (found here:
http://www.lebans.com/rownumber.htm
Thank you Stephen!) but the unbound text box on the subform shows #Name?
when the form is opened. Obviously I've done something wrong. I've been
*dabbling* in code for some time, but I'm still a newbie and am therefore
prone to many, many amatuerish mistakes. Here's the code:
'Copyright Stephen Lebans 1999
'May not be resold
'Please include my 1 line Copyright notice
'in your code if you use these functions
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
What could the issue be? Thanks in advance!
numbered 1, 2, 3, etc. I personally see no use for that - at least in this
situation, but for whatever reason, the user would prefer it. So, I tried
using Stephen Lebans' RowNum solution (found here:
http://www.lebans.com/rownumber.htm
Thank you Stephen!) but the unbound text box on the subform shows #Name?
when the form is opened. Obviously I've done something wrong. I've been
*dabbling* in code for some time, but I'm still a newbie and am therefore
prone to many, many amatuerish mistakes. Here's the code:
'Copyright Stephen Lebans 1999
'May not be resold
'Please include my 1 line Copyright notice
'in your code if you use these functions
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
What could the issue be? Thanks in advance!