Solved

running mdb from the command line

Posted on 2003-12-12
6
1,939 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

746 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now