J
JohnE
I have the following that I am placing into a module as a function since it
was decided to use it on all forms to show the number of records each client
has. But, I am running into an error that points back to the Me in the line
Set rst = Me. Recordset.Clone. Originally, this was only on one form and
worked fine. Now it is to go on all applicable forms. How would the Me be
worked around so this function can be applied to all forms?
Function Form_Current()
On Error GoTo Form_Current_Err
Dim lngCount As Long
Set rst = Me.Recordset.Clone
If rst.EOF = False Then
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
Me.txtRecordNumber = "Record " & Me.CurrentRecord & " of " &
lngCount & " for " & [Clientcode]
Else
Me.txtRecordNumber = "Record 0" & " of 0"
End If
Form_Current_Exit:
Exit Function
Form_Current_Err:
MsgBox "The number of records will not be available.", vbOKOnly, "Record
Count"
Resume Form_Current_Exit
End Function
Thanks to anyone who responds.
*** John
was decided to use it on all forms to show the number of records each client
has. But, I am running into an error that points back to the Me in the line
Set rst = Me. Recordset.Clone. Originally, this was only on one form and
worked fine. Now it is to go on all applicable forms. How would the Me be
worked around so this function can be applied to all forms?
Function Form_Current()
On Error GoTo Form_Current_Err
Dim lngCount As Long
Set rst = Me.Recordset.Clone
If rst.EOF = False Then
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
Me.txtRecordNumber = "Record " & Me.CurrentRecord & " of " &
lngCount & " for " & [Clientcode]
Else
Me.txtRecordNumber = "Record 0" & " of 0"
End If
Form_Current_Exit:
Exit Function
Form_Current_Err:
MsgBox "The number of records will not be available.", vbOKOnly, "Record
Count"
Resume Form_Current_Exit
End Function
Thanks to anyone who responds.
*** John