Error for record counter on first entry

Timoty

Registered User.
Local time
Today, 12:02
Joined
Jul 29, 2003
Messages
105
I have a form that needs to be locked up tight so I created a record counter instead of using the one that is built into Access. In order for this to work there is code for the on current action for the form. This works without error. However, I stripped all of the 'test'data out of the tables for distribution and the form will no longer open. I suspect that this is because of the statement 'Me.RecordsetClone.MoveLast' when there is no records to move to the last of. Is there any way to get around this without putting in dummie data? The On current info is below.

Private Sub Form_Current()
Me!txtCurrent = Me.CurrentRecord
Me.RecordsetClone.MoveLast
Me!txtTotal = Me.RecordsetClone.RecordCount
End Sub
 
For those interested, I figured out a solution.

I added:

If Me.RecordsetClone.RecordCount = 0 Then
Forms!main!DocNum.SetFocus
Else
Me!txtCurrent = Me.CurrentRecord
Me.RecordsetClone.MoveLast
Me!txtTotal = Me.RecordsetClone.RecordCount
End If
 

Users who are viewing this thread

Back
Top Bottom