Results 1 to 9 of 9
  1. #1
    manissinha is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    21

    Either BOF or EOF is True, or the current record has been deleted _ ERROR while search record from

    Hi all




    I have create an userform in excel with Access back end for add record and search record. Add record is working finn but when i search record it gives data which is already added in database but if i search record which is not added in database it gives error : " Either BOF or EOF is True, or the current record has been deleted"

    please help me to resolve this error

    i am attaching the sample file for your reference
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Trap for the error:
    Code:
    sub btnFind_click()
    
    On error goto ErrTrap
    
    '....Your find code here....
    
    exit sub
    ErrTrap:
    msgBox "Not Found"
    end sub

  3. #3
    manissinha is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    21
    Thanks ranman256

    its done ....and working perfectly

    now i also want to update existing record (after search) in access database with update button ...

    how it is possible .. please help..

    thanks



  4. #4
    manissinha is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    21
    a i am using below code but its not working,,,
    Code:
    Private Sub cmdUpdate_Click()
       Dim conn As ADODB.Connection
       Dim myRecordset As ADODB.Recordset
       Dim strConn As String
       strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Data2.mdb"
       Set myRecordset = New ADODB.Recordset
       With myRecordset
          .Open "Select * from Table1 Where Name = TextBox0.Value "
             strConn , adOpenKeyset, adLockOptimistic
          .Fields("username").Value = "TextBox1.Value"
    
          .Update
          .Close
       End With
       Set myRecordset = Nothing
       Set conn = Nothing
    End Sub

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You have to concatenate the form reference. Presuming the data type is text:

    .Open "Select * from Table1 Where Name = " & Chr(34) & TextBox0.Value & Chr(34)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    manissinha is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    21
    Thanks pbaldy ...

    i tried but giving compile error ..

    attached screenshot is error msg for you reference...
    Attached Thumbnails Attached Thumbnails Untitled.png  

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I don't use ADO much, but you need a comma to separate the arguments. It was missing in the original as well.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Also line continuation character if you want to wrap command to multiple lines.
    Code:
          .Open "Select * from Table1 Where [Name] = '" & Me.TextBox0 & "'", _
                  strConn, adOpenKeyset, adLockOptimistic
    Name is a reserved word. Should not use reserved words as names for anything. If you do - as well as use spaces or punctuation/special characters (underscore only exception) - enclose in [ ].
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    manissinha is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    21
    Thanks june7

    now its working..... thanks a lot

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error Message: No Current Record
    By arlrodri in forum Reports
    Replies: 2
    Last Post: 06-05-2014, 07:02 AM
  2. deleted record error after delete query
    By ck4794 in forum Queries
    Replies: 3
    Last Post: 10-12-2013, 02:04 PM
  3. Error 3021 no current record
    By bbrazeau in forum Programming
    Replies: 10
    Last Post: 12-13-2012, 04:22 PM
  4. 'No Current Record' Error
    By tylerg11 in forum Forms
    Replies: 1
    Last Post: 08-02-2012, 01:53 PM
  5. Replies: 8
    Last Post: 05-16-2011, 06:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums