'NO CURRENT RECORD' Error in Subform

M

Mike Thomas

In Access 2000, we have a typical receipt type of form which contains a
subform with the receipt line items.

There is a button in the parent form which does a lookup using the ID key of
whichever line is selected in the subform.

When there is only one line in the subform, we always get the error above on
the line:

lngRIPK = Me.ReceiptSub.Form.Recordset!ripk

Clicking on the line does not fix the problem.

If there is more than one line, we get the error if we do not click on a
record (but the first rec is highlited). If we click on the second, or
later line, everything works fine. If we go back and click on the first
line, that works too.

How can I fix this problem?

Many thanks
Mike Thomas
 
A

Allen Browne

Try without the Recordset bit.
lngRIPK = Me.ReceiptSub.Form!ripk

If lngRIPK is declared as a Long, the code will still error if ripk is Null.
 
M

Mike Thomas

Allen,

Many thanks again for your help.

I seemed to have solved the problem by putting the field's value into an
invisible text box (txtRIPK) on the sub form, then getting the value as
follows:

lngRIPK = Nz(Me.ReceiptSub.Form!txtRIPK,0)

So far, so good.

Mike Thomas
 

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