No Current Record error

  • Thread starter Thread starter Robert
  • Start date Start date
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
 
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
 
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
 
Back
Top