Solved

running mdb from the command line

Posted on 2003-12-12
6
1,945 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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 500 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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

730 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