Link to home
Start Free TrialLog in
Avatar of amtate
amtate

asked on

running mdb from the command line

Hi,

I need to be able to open my .mdb file automatically (- via scheduled task or autosys etc.) - in order for a call to be made to an 'initialise data' function which is called from the start-up 'autoexec' macro.

This purpose of this is to prevent users from having to explicitly perform this during holiday periods etc., and so that the database contains daily details...

The problem is that I need to suppress update confirmation msg's when rows are updated etc against tables - as this will be initiated from a command line by a scheduled task

 - i.e. " myData.mdb/excl"

I can use "DoCmd.SetWarnings False" which works fine when I double-click to open the .mdb, though as soon as I try to open it from the command prompt I get an error along the line of:

"There was a problem sending the command to the program."
or

"Windows cannot find the file myData.mdb....."

- so it seems to be a problem calling from command line.

Does any know how to overcome this problem?

(btw I have also tried to use db.Execute strSQL rather than DoCmd.RunSql - though this doesn't overcome the problem..

Any help would be grately appreciated

Rgds, Andy
Avatar of heer2351
heer2351

Could you please post your command line? I doubt it has anything todo with the docmd.setwarnings.
Try
application.setoptions "Confirm Action Queries", False
at the end of the script,
application.setoptions "Confirm Action Queries", True

Phythaelic
Actually, should be setoption, not setoptions.
Avatar of amtate

ASKER

Phythaelic - do you mean as in the following command text:

L:\Initialise Data>myData.mdb/application.setoption "Confirm Action Queries", False

- as I've tried running the above, though I get the same error msg.

Incidentally - when I check within my .mdb, the vba code HAS executed successfully - with table rows being updated accordingly!

- it's just that when control returns to the command line for some reason it thinks it has encountered an error - and I get an error MessageBox along with "The system cannot execute the specified program." command line text.

The problem is that if this is running under autosys - then it's going to abend, with possible call-out consequences which I want to avoid!

Rgds, Andy
ASKER CERTIFIED SOLUTION
Avatar of heer2351
heer2351

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of amtate

ASKER

Thanks heer2351 - that worked with no probs!!

Rgds, Andy