run code at startup

G

Guest

I want to make it so the macro security warnings do not come up when my
database is started and I found this code that claims to do it however I was
wondering where should I put this code. It seems like it should run on
startup but where do I find this at?

The code is:
dim o
set o=createobject ("Access.Application")
o.automationsecurity=1 ' set macro security LOW.
o.opencurrentdatabase "full path to your database"
o.usercontrol=true
set o=nothing
 
A

Albert D.Kallal

You can just go tools->macro security->set it to low.

If you do the above..then you don't get any warnings...

It is not clear if you need to do this for other machines, or not.

The example code you have given looks like a windows scripting file, and
not ms-access code.

You would thus place the code in a simple text file, and then re-name the
extension of the file to vbs. Then, when you double click on this file, your
script would run. (you do have to have file extensions turned on to rename
the file correctly).
 
G

Guest

Hi Dan,

Open Notepad and paste your code into a new text file. Save the file with
the .VBS file extension (Visual Basic Script). I don't think you want the
last part that you included, ie:


Try creating a file without that stuff. Make sure to include the full path
to your database, including the name of the file. For example:

o.opencurrentdatabase "C:\Databases\Test.mdb"

You might want to have a look at Jeff Conrad's page:
http://home.bendbroadband.com/conradsystems/accessjunkie/macrosecurity.html

If my answer has helped you, please answer yes to the question that reads
"Did this post answer the question?" at the bottom of the message thread.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I want to make it so the macro security warnings do not come up when my
database is started and I found this code that claims to do it however I was
wondering where should I put this code. It seems like it should run on
startup but where do I find this at?

The code is:
dim o
set o=createobject ("Access.Application")
o.automationsecurity=1 ' set macro security LOW.
o.opencurrentdatabase "full path to your database"
o.usercontrol=true
set o=nothing
 
J

Jeff Conrad

That code is by TC and is not to be used inside Access, but
instead in a desktop shortcut.

Here is a copy of TC's instructions:1. Open Notepad or a similar "plain text" editor.

2. Type in the code that I showed in my previous post:

dim o
set o=createobject ("Access.Application")
o.automationsecurity=1 ' low.
o.opencurrentdatabase "full path to your database"
o.visible=true
o.usercontrol=true
set o=nothing

(Type one statement per line. Note that the 'o's are letters, not
digit zeros. Be sure to replace "full path to your database" with the
full path to your database(!) - eg. "C:/windows/desktop/mydb.mdb".)

3. Save the file to your desktop. Give it any name you want, but be
sure that it ends with a .bat (not .txt) extension.

Now you can start your database by double-clicking the .bat file. The
macro security warnings should not appear.

There are certain cases where this might *not* work, eg. if a virus
scanner interferes with starting the batch file. But it is so easy to
try, that you should give it a go.

Good luck,
TC
BTW, when I used a BAT extension it would not work. But with
a .VBS extension it worked fine.

--
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html

in message:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top