Why Error - "No Current Record"

  • Thread starter Thread starter Mike Thomas
  • Start date Start date
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
 
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

?
 
Back
Top