Hi there. I have just written some code, and keep getting the error message Either Eof or Bof is true, or the current record is deleted, the operation requested needs a current record. This is the code that generates this error.
strCurrentTransactionID = GetNextTransactionID()
strUPCToUpdate = Mid(Tag, 1, 1) & Format(cboSelection.ItemData(cboSelection.ListIndex), "0000")
gstrRset.Source = "SELECT fldquantity from tblInventory Where fldProductId = '" & strUPCToUpdate & "'"
gstrRset.Open
If gstrRset!fldquantity >= Val(lblActualData.Caption) Then
With comUpdate
.CommandText = "INSERT into tblTransactions Values('" & _
strCurrentTransactionID & "', 'R', '" & _
Format(Date, "mm/dd/yyyy") & _
"','" & gstrRset!fldProductID & "'," & _
gstrRset!fldTransactionQuantity & "," & _
gstrRset!fldTransactionQuantity + Val(lblActualData.Caption) & ", '" & _
" & gstrRset!fldTransactionPrice & "
.Execute
End With
GenerateNextTransactionID (strCurrentTransactionID)
With comInventory 'to update inventory table
.CommandText = "Update tblinventory SET fldquantity = " & _
gstrRset!fldquantity + Val(lblActualData.Caption) & _
" WHERE fldproductID = '" & strUPCToUpdate & "'"
.Execute
End With
End If
cmdUpdate.Enabled = False
(lblInvoiceNumber.Caption, 6))
endsub:
Set gstrRset = Nothing
Set comUpdate = Nothing
Set comInventory = Nothing
cmdUpdate.Enabled = False
gstrMessage = "Transaction completed!"
gstrTitle = "Update status"