Table of Content
    Access Database Repair

    How to Fix MS Access Error 3159 – “Not A Valid Bookmark”?


    Table of Content

      Summary: MS Access users may encounter the "Not a valid bookmark” error when using the record set in VBA projects. This blog will discuss the reasons behind “MS Access error 3159: Not a valid bookmark” and the solutions to resolve it. You’ll also find about an Access database repair tool that can help fix the error if it occurs due to corrupted records in the database.

      The MS Access error “Not a valid bookmark” usually occurs when you set the bookmark property of a record set with an invalid string. The bookmark property is used to access/fetch records in database tables.

      The error appears like this:

      Runtime Error 3159 Not A Valid Bookmark Error Message

      There are various reasons that may lead to the “Not a valid bookmark” error in Microsoft Access, such as:

      • When you set a Recordset.bookmark property (DAO) with an invalid string.
      • When your Access database is corrupted.
      • When you try to bookmark a string that was not saved earlier.

       Methods to Fix MS Access Error 3159: Not a Valid Bookmark

      You can try the following solutions to resolve the MS Access error 3159.

      Method 1: Reproduce the Error

      If you get the “Not a valid bookmark” error due to invalid string in the bookmark property, then you can reproduce the error to find and correct the string. For this, use the below code in the module:

      Option Compare Database
      Private Sub Command0_Click()
      Dim rst As Recordset
      Dim str As String
      Error 3159 Not a valid bookmark.
      Set rst = CurrentDb.OpenRecordset("Orders", dbOpenDynaset)
      str = rst(0)
      rst.Bookmark = str
      End Sub

      Codewindow With Error Code Not A Valid Bookmark

      On the error message window, click the Debug option and then,

      • Use the correct string.
      • Update the string and save it for later.

      Method 2: Use the Decompile Command

      When VBA code throws an error or behaves oddly, you can use the Decompile command. This command is used to fix VBA-related errors. To use the Decompile command, follow these steps:

      • Identify the path of your Microsoft Access. For this, you can search your Access program from Windows Explorer.
      • Open the Command Prompt window by typing cmd in the Run utility.
      Run Window
      • Click OK.
      • The cmd.exe window is displayed.
      CMD Window With Black Screen
      • Enter the following Decompile command.

      C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE /decompile

      • Now, open the MS Access database.
      • Click Create > Module.
      Create Module In Access
      • Go to Debug > Compile.
      Compile Code In Vba In Microsoft-Access
      • Click File and then Save.

      Method 3: Repair the Database

      Sometimes, the MS Access error 3159 can occur when the MS database is corrupted. You can use the built-in utility – Compact and Repair – to repair the damaged or corrupted database. To run this tool, follow these steps:

      • Open Microsoft Access.
      • Go to File > Info > Compact & Repair Database.
      Compact And Repair Database Window
      • Select the corrupt Access database file and then click OK.

      Now, check if the issue is resolved. If the error persists or the “Compact and Repair utility doesn’t work”, then you can use a professional Access repair tool, like Stellar Repair for Access. This tool is recommended by certified database experts to repair corrupt Access database files (.ACCDB and .MDB). It helps you recover all the database objects, including queries, reports, tables, reports, etc. The tool is compatible with Office 365, Access 2019, 2016, 2013, and lower versions.

      Closure

      The MS Access error 3159 occurs when working with recordsets in VBA code. It usually occurs when you try to use an invalid string while setting the Recordset.Bookmark property. You can fix the issue by reproducing the error and then correcting the string value. If the database is corrupted, you can use the Compact and Repair tool in MS Access. If this utility fails, you can try Stellar Repair for Access to repair the corrupt Access database files. It can fix severely corrupted database files and recover all the data without changing its original structure. It is an advanced tool that can help you fix MS error 3159 or any other corruption-related error.

      Was this article helpful?

      No NO

      About The Author

      Monika Dadool linkdin

      Monika Dadool is a Senior Content Writer at Stellar with over 5 years of experience in technical writing. She is a tech enthusiast and expert who specializes in writing about SQL Server, MySQL Server, MariaDB Server, Microsoft Access, Active Directory, email recovery, Microsoft 365, pattern recognition, machine learning, data recovery, file repair, and operating systems like Linux, Windows, and Mac. She also writes about accounting software such as QuickBooks and Sage 50, as well as web-scripting languages like HTML, JavaScript, Python, PHP, Visual Basic, ASP.NET, and AJAX. Monika is passionate about researching and exploring new technologies, and she enjoys developing engaging technical blogs that help organizations and database administrators resolve various issues. When she's not creating content, you can find her on social media, watching web series, reading books, or exploring new food recipes.

      Related Posts

      WHY STELLAR® IS GLOBAL LEADER

      Why Choose Stellar?

      • 0M+

        Customers

      • 0+

        Years of Excellence

      • 0+

        R&D Engineers

      • 0+

        Countries

      • 0+

        PARTNERS

      • 0+

        Awards Received