CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    47

    Run-time error 3021 No current record

    Hi,

    In the beginning of database (access database) is empty and I want to add a new record and then cancel it. But I get an error
    "Run-time error 3021 No current record" when I press Cancel button. Here is the code in cmdCancel:

    Private Sub cmdCancel_Click()

    Data1.UpdateControls
    Data1.Recordset.Bookmark = vbookmark3

    End Sub

  2. #2
    Join Date
    May 2002
    Location
    Colombo,Sri Lanka
    Posts
    1,110
    I think ur bookmark is invalid

  3. #3
    Join Date
    Aug 1999
    Posts
    28
    I'e run into this problem many times, especially when you start a new database without any records in it yet.
    What I usually do is to set up an Error catch for it.

    Ie.

    (At beginning of procedure)

    On Error Goto ErrorHandler

    (Procedure)

    ErrorHandler:
    If Err.Number = 3021 Then
    Resume Next (or other code)
    Else
    MsgBox Err.Number & vbCrLf & Err.Description
    End If


    This may help - Have a good day

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

Featured