No Current Record error

R

Robert

I have a form with a subform on it. When I open the form with the acFormAdd
option (to add a new record) I get the error "No Current Record" on the
following:

Me.RecordsetClone.MoveLast

which is in the load event of a subform on the form.

The statements

Me.RecordsetClone.MoveLast
Me.RecordsetClone.MoveFirst

are in my subform so the "Item n of n Items" label box will show the correct
number of items.

How can I avoid this error message?

Robert
 
A

Allen Browne

When you open a form in add mode, it does not load any records.
Consequently, the instruction to move to the last record fails, since there
is no last record.

Perhpas you could avoid the move by testing the NewRecord property:

If Not Me.NewRecord Then
With Me.RecordsetClone
.MoveLast
.MoveFirst
End With
End If
 
R

Robert

Thnk you. That appears to be working.
Allen Browne said:
When you open a form in add mode, it does not load any records.
Consequently, the instruction to move to the last record fails, since
there is no last record.

Perhpas you could avoid the move by testing the NewRecord property:

If Not Me.NewRecord Then
With Me.RecordsetClone
.MoveLast
.MoveFirst
End With
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top