Run time 91 "Object variable or With block variable is not set "

access Canada
  • 15 years ago

    Hello,

    I  intend to disable shift key to prevent the user from bypassing startup options when opening Access project.

    I google searched ,and found a piece of code that does such function.

        Dim db As DAO.Database
        Dim prp As DAO.Property

        Set db = CurrentDb()
        db.Properties.Delete "AllowBypassKey"
        Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, False, True)
        db.Properties.Append prp


        db.Properties.Refresh

        Set prp = Nothing
        Set db = Nothing


    I created a new module, and add the code above into a methd A. Then I add refrenence to DAO activex,  and a button on a from to trigger the execution of Method A. I got the runtime error "Object variable or With block variable is not set ".

    The working environment  is windows XP profersional, MS Access 2003.

    Is there someboday who had similar problem? Thanks a million

     

     

    Daniel

     

     

     

     

     

     

     

     

     

     

     

     

     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Brevity is the soul of wit” - Shakespeare