Hi,

I have this piece of code in an access module:

I have this piece of code in an access module and every time it is called, I get the error message ¡§No Current Record¡¨.

sqlStr = "SELECT * FROM [Arrangement$Product] WHERE Arrangement_Id =" & inArrangementID
Set rst = CurrentDb.OpenRecordset(sqlStr, dbOpenDynaset)

With rst
Do Until rst.EOF

lProduct_Count = rst!product_count
tblReceivied_Date = rst!Product_received_Date
lProduct_Id = rst!Product_id

sqlStr2 = "SELECT distinct Product.Qty_On_Hand as Qty_On_Hand, Product.Life_Span As Life_Span, Product.Reorder_Level as Reorder_Level FROM Product " & _
"WHERE Product.Product_Id =" & lProduct_Id & " And Product.Received_Date = " & tblReceivied_Date & ";"
Set rst2 = CurrentDb.OpenRecordset(sqlStr2, dbOpenDynaset)
tblQty_On_Hand = rst2!Qty_On_Hand ¡¥„²---- The error occurs at this line
tblLife_Span = rst2!Life_Span
tblReorder_Level = rst2!Reorder_Level
Set rst2 = Nothing

NewQtyOnHand = tblQty_On_Hand + lProduct_Count

lExpire_Date = tblReceived_Date + tblLife_Span
If lExpire_Date <= Date Or NewQtyOnHand > tblReorder_Level Then
sqlStr3 = "UPDATE Product set product.Qty_On_Hand = " & NewQtyOnHand & " WHERE product.Product_Id= " & lProduct_Id & " AND Product.Received_Date = " & tblReceived_Date & ";"
Debug.Print sqlStr3
DoCmd.RunSQL sqlStr3
Set rst3 = Nothing
End If

rst.MoveNext
Loop
rst.Close
End With
End If


Please help, Thanks a lot.