Results 1 to 6 of 6

Thread: Either EOF or BOF is True

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Location
    Canada
    Posts
    10

    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"

  2. #2
    Lively Member
    Join Date
    Jan 2002
    Posts
    69
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Location
    Canada
    Posts
    10
    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?

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Is tblInventory empty?

  5. #5
    Addicted Member
    Join Date
    May 1999
    Posts
    161
    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...

  6. #6
    Addicted Member Mandelbrot's Avatar
    Join Date
    Aug 2001
    Location
    Work, as usual!!
    Posts
    241
    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
  •  



Click Here to Expand Forum to Full Width