locked
VB.Net syntax to "Set" DAO.dbMaxLocksPerFile (Setting for MS Access) RRS feed

  • Question

  • Note: Added Microsoft DAO 3.6 Object Library into my VB.Net Project
             Also added "Imports DAO" to the code file

    Would like to increase the Registry default from 9,500 to 200,000

    in VBA, this works just fine: DAO.SetOption dbMaxLocksPerFile, 200000

    The following do not work:
    DAO.DBEngine.SetOption(DAO.DBEngine, 200000)
    DAO.DBEngine.SetOption DAO.DBEngine.dbMaxLocksPerFile, 200000
    DAO.SetOptionEnum.dbMaxLocksPerFile(200000)

    I did find the following in the Object browser:
    Public Const dbMaxLocksPerFile As Microsoft.Office.Interop.Access.Dao.SetOptionEnum = 62
    (Not sure what "62" means and/or how to Set/Reset it)

    Any thoughts greatly appreciated!

    Dennis

    • Moved by Cindy Meister MVP Friday, April 19, 2013 4:48 PM not vsto-technology related
    Friday, April 19, 2013 1:00 PM

Answers

  • Hi Dennis,

    Try the following code:     

            Dim dbe As DAO.DBEngine
            dbe = New DAO.DBEngine
            Dim db As DAO.Database
            db = dbe.OpenDatabase("D:\\Nwind.mdb")
            dbe.SetOption(DAO.SetOptionEnum.dbMaxLocksPerFile, 20000)
            Console.Read()
    

    The image is screenshot from the object browser of VBE in Access.

    Good day.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Dummy yoyo Monday, April 29, 2013 8:58 AM
    Monday, April 22, 2013 7:49 AM

All replies

  • Note: Added Microsoft DAO 3.6 Object Library into my VB.Net Project
             Also added "Imports DAO" to the code file

    Would like to increase the Registry default from 9,500 to 200,000

    I would prefer not to actually change the Registry; but by Command.

    in VBA, this works just fine: DAO.SetOption dbMaxLocksPerFile, 200000

    The following do not work:
    DAO.DBEngine.SetOption(DAO.DBEngine, 200000)
    DAO.DBEngine.SetOption DAO.DBEngine.dbMaxLocksPerFile, 200000
    DAO.SetOptionEnum.dbMaxLocksPerFile(200000)

    I did find the following in the Object browser:
    Public Const dbMaxLocksPerFile As Microsoft.Office.Interop.Access.Dao.SetOptionEnum = 62
    (Not sure what "62" means and/or how to Set/Reset it)

    Any thoughts greatly appreciated!

    Dennis



    Friday, April 19, 2013 11:23 AM
  • Hi Dennis,

    Try the following code:     

            Dim dbe As DAO.DBEngine
            dbe = New DAO.DBEngine
            Dim db As DAO.Database
            db = dbe.OpenDatabase("D:\\Nwind.mdb")
            dbe.SetOption(DAO.SetOptionEnum.dbMaxLocksPerFile, 20000)
            Console.Read()
    

    The image is screenshot from the object browser of VBE in Access.

    Good day.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Dummy yoyo Monday, April 29, 2013 8:58 AM
    Monday, April 22, 2013 7:49 AM