Why Error - "No Current Record"

M

Mike Thomas

In Access 2000 I have a button in a receipt form which deletes the highlited
row in a subform. I need to do a check in another table to make sure the
subform table's record's primary key is not in any record in that table.

I am receiving a No Current Recrd error when I run this code in the button's
click event:

Set rst = CurrentDb.OpenRecordset( _
"SELECT * From [receiptitems]" & _
" WHERE RctxKey = " & Me.RctEtsSub1.Form.Recordset!rxpk, _
dbOpenSnapshot)

This part - Me.RctEtsSub1.Form.Recordset!rxpk - is causing the problem.

When I go to Immediate window and run

? Me.RctEtsSub1.Form.Recordset.recordcount - returns 1, correct
? Me.RctEtsSub1.Form.Recordset.eof - returns False
? Me.RctEtsSub1.Form.Recordset.bof -returns false

? Me.RctEtsSub1.Form.Recordset!rxpk - returns NO CURRENT RECORD

The correct record is highlited in the subform. This happens with some
receipt, but not with others.

Any ideas?

Thanks
Mike Thomas
 
B

Bruce M. Thompson

In Access 2000 I have a button in a receipt form which deletes the highlited
row in a subform. I need to do a check in another table to make sure the
subform table's record's primary key is not in any record in that table.

I am receiving a No Current Recrd error when I run this code in the button's
click event:

Set rst = CurrentDb.OpenRecordset( _
"SELECT * From [receiptitems]" & _
" WHERE RctxKey = " & Me.RctEtsSub1.Form.Recordset!rxpk, _
dbOpenSnapshot)

This part - Me.RctEtsSub1.Form.Recordset!rxpk - is causing the problem.

What happens when you change that reference to read:

Me.RctEtsSub1.Form!rxpk

?
 

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