?
Solved

running mdb from the command line

Posted on 2003-12-12
6
Medium Priority
?
1,953 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:amtate
  • 2
  • 2
  • 2
6 Comments
 
LVL 23

Expert Comment

by:heer2351
ID: 9927418
Could you please post your command line? I doubt it has anything todo with the docmd.setwarnings.
0
 
LVL 2

Expert Comment

by:Phythaelic
ID: 9927433
Try
application.setoptions "Confirm Action Queries", False
at the end of the script,
application.setoptions "Confirm Action Queries", True

Phythaelic
0
 
LVL 2

Expert Comment

by:Phythaelic
ID: 9927441
Actually, should be setoption, not setoptions.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:amtate
ID: 9927529
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
0
 
LVL 23

Accepted Solution

by:
heer2351 earned 2000 total points
ID: 9927584
Try running your database with the following command line:

"fullPathToAccess" "fullPathToDatabase"

example:
L:\Initialise Data>"c:\program files\microsoft office\office10\msaccess.exe" "L:\Initialise Data\myData.mdb"
0
 

Author Comment

by:amtate
ID: 9927641
Thanks heer2351 - that worked with no probs!!

Rgds, Andy
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question