|
-
Jul 1st, 2002, 07:01 PM
#1
Thread Starter
New Member
Either EOF or BOF is True
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"
-
Jul 1st, 2002, 08:08 PM
#2
Lively Member
add this line to check if eof or bof is = true
if not (gstrRset.bof = true or gstrRset.eof = true) then
your code
end if
I think it could resolve your problem
-
Jul 1st, 2002, 08:28 PM
#3
Thread Starter
New Member
Hey thanks. I gave it a try, but unfortunately it did not work. However, the value for both was true, now how can that be? Any other ideas?
-
Jul 1st, 2002, 11:39 PM
#4
-
Jul 2nd, 2002, 07:27 AM
#5
Addicted Member
BOF and EOF are acting somewhat against what one would normally think...
BOF is True when pointing before your first record and False after.
EOF is True when pointing after your last record and False before that.
So... when both are True, it means that you are before and after your recordset... i.e. you have no records returned. So back to Mendhack's comment, tlbInventory could be empty, or your condition is too restricive...
-
Jul 2nd, 2002, 10:36 AM
#6
Addicted Member
Could also be that there are no records in the recordset. Try checking your recordset first.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|