Automation & Command line arguments

C

Chris

I've done a TON of looking and reading on this subject and have found some
ideas, but nothing that is working for me. I could really use some insight
here. Access 2003, XP

In a nutshell:

1. I want to open my app via a scheduled task.
2. I want to send the database a command line argument (in order to specify
which task to run).
3. I do not want the security warnings to come up.
4. I want my scheduled code to run (which, depending on the task, takes
between 30 seconds and about 2 minutes.)
5. I want the database to close.


I have tried to make a script with the code:

dim o
set o=createobject ("Access.Application")
o.automationsecurity=1 ' set macro security LOW.
o.opencurrentdatabase "mypath\mydb.mdb"
o.visible=true
o.usercontrol=true
set o=nothing

which bypasses the security but then hangs Access without completing the task.


Any help?
 
A

Albert D. Kallal

If you going to have the permissions to install, setup and run a task
without
user intervention, then you need to have proper permissions to do this task.

The Simple solution here then, is to have macros of security set to low on
that machine.

The idea that you're going to run some code that sets the macro security to
low to allow you to run the code which defeats the security implications in
the first place is really kind of insanity here.

Simply put, you have the two choices for your boss:

1) you have employee come in who has proper rights and ability to run this
application, and they get paid to come in and run this application.

2) You need to give the computer permissions t run this stuff unattended.

Simple put, you need a macro security setting to low if you're going to have
this run properly. So, set your macro security to low and all the security
prompts and problems will be gone.

I just plain how to schedule set up a batch file in ms-access here:

http://www.members.shaw.ca/AlbertKallal//BatchJobs/Index.html

The beauty of the above protest is that the above windows script will
actually execute a standard subroutine in a standard code module inside of
MS access. This means you don't have to fool around with silly command line
arguments etc.

the other approaches that over time you can modify your windows script to
execute Savr routines, it is at the end of the script that correctly in
nicely shuts down access when it's done.

So I recommend the above approach.
 
C

Chris

Thanks for the help. I've seen your page in my research before and have
tried that script. When I run it I get a "server threw an exception" error.
It opens my db fine and starts to execute my code, but hangs before
completion with the error. If I run my code in isolation, it works fine.

(Incidentally, my code opens a connection to Excel with a Reuters addin and
retrieves data. The Reuters data is then saved to a table in my app. A
report is created and saved to pdf via Lebans pdf utility, the report is
emailed, and the db closes.)
 

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

Similar Threads


Top