Reputation: 1
I want my subform
to have a sequential numbering on the left part and it will be dynamic depending on the loaded data from the relationship between the main form to subform
by the parent and child link
I have this one it works fine.
Public Function RowNum(frm As Form) As Variant
On Error GoTo err_RowNum
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
and on the subform
on where the number will be shown I added unbound textbox
and the control source I input this code =RowNum([Form]
).
everything works good. unfortunately when I add new line below the last row, the number didn't update, it sticks to the last number and copy to the row where i am inputting new row.
Upvotes: 0
Views: 38