Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

running mdb from the command line

Posted on 2003-12-12
6
Medium Priority
?
1,951 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

618 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