dcsimg
Results 1 to 11 of 11

Thread: 3021: Either BOF or EOF is True, or the current record has been deleted.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    110

    3021: Either BOF or EOF is True, or the current record has been deleted.

    Code:
    Private Sub displ_eord()
    Set Record = New ADODB.Recordset
    Record.Open "Select * from payment where orde ='" & txtEOrd.Text & "' and bal <> paid", Connect, 3, 3
    If Not Record.EOF Then
        txtcusname.Text = Record!cusname
        txtTown.Text = Record!cit
        Record.Close
        Else
    Set Record = Nothing
    End If
    End Sub
    Last edited by rasheedraj@gmail.com; Feb 13th, 2019 at 08:09 AM.

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    1,830

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    Nevermind the issues with parameters (or just slapping a piece of code in here for all others to guess what the problem is)
    This looks fishy to me:

    Code:
    and bal <> paid
    This looks like a string.
    shouldn't that be
    Code:
    and bal <> 'paid'
    EDIT: Or is "paid" another columnname in the same table?
    One System to rule them all, One IDE to find them,
    One Code to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    110

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    Code:
    Record.Open "Select * from payment where orde ='" & txtEOrd.Text & "' and bal <> 'paid'", Connect, 3, 3
    Did not display any data
    Last edited by rasheedraj@gmail.com; Feb 14th, 2019 at 05:31 AM.

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,455

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    Better answer the question: is paid a column in your table?

    Make sure you have "Option Explicit" on top of every form/module/class

    Code:
    Private Sub displ_eord()
      Dim oRS As ADODB.Recordset
      Dim sQuery As String
      
      Set oRS = New ADODB.Recordset
      sQuery = "Select * from payment where orde ='" & txtEOrd.Text & "' and bal <> paid"
      
      ' Instead of using numeric values, use the enumeration values
      ' oRS.Open sQuery, Connect, 3, 3
      oRS.Open sQuery, Connect, adOpenStatic, adLockOptimistic
      
      ' Check for both EOF and BOF
      If Not oRS.EOF And Not oRS.BOF Then
        ' Move to the first record
        oRS.MoveFirst
        txtcusname.Text = oRS!cusname
        txtTown.Text = oRS!cit
      End If
      
      oRS.Close
      Set oRS = Nothing
    End Sub

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    110

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    Paid Also belong to same table

  6. #6
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,455

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    Have you tried the version of subroutine I posted?

  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    110

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    Code:
    Private Sub displ_eord()
    Dim oRS As ADODB.Recordset
      Dim sQuery As String
      
      Set oRS = New ADODB.Recordset
      sQuery = "Select * from payment where orde ='" & txtEOrd.Text & "' and bal <> paid"
      oRS.Open sQuery, Connect, adOpenStatic, adLockOptimistic
      If Not oRS.EOF And Not oRS.BOF Then
        oRS.MoveFirst
        txtcusname.Text = oRS!cusname
        txtTown.Text = oRS!cit
    End If
    End Sub
    No records came to display

  8. #8
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,455

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    Then maybe, just maybe, the query does not return any results?

    What does the query looks like?

  9. #9
    Frenzied Member ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    1,921

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    what is txtEOrd ? number or a String
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    110

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    txtEord.text is a number

  11. #11
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,455

    Re: 3021: Either BOF or EOF is True, or the current record has been deleted.

    If the column orde is also numeric then you shouldn't place the value between ''.
    The query would become:
    sQuery = "Select * from payment where orde =" & txtEOrd.Text & " and bal <> paid"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width