Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access2000 & Batch file /Cmd prompt

Status
Not open for further replies.

hats666

Programmer
Feb 9, 2004
4
US
When I try to invoke an Access 2000 database from a batch file, I am running into issues.

In a batch file, I have
start /wait g:\arisdb.mdb

When the batch file is executed, it starts the arisdb.mdb and does what it is supposed to do and then closes the database as expected.

However after the Access database is closed, the following error appears "Cannot find the file 'g:\arisdb.mdb'(or one of its components). Make sure the path and the filename are correct and that all required libraries are available"

The batch file references the access database only once and each time, it is finds and completes the access database step and then the error appears.

Also at the regular command prompt, when I tried
g:\> start /wait g:\arisdb.mdb
or
g:\> start g:\arisdb.mdb
or
g:\> start arisdb.mdb
or
g:\> arisdb.mdb

Each time it finds and opens the database but in the command window has the following error
"The system cannot execute the specified program."

Can anyone please shed some light on this and let me know how this should be resolved.

Thanks,
Hats666
 
Just a wild guess, but could it have something to do with Repair & Compact on close?
 
Hello,

Thank you for this suggestion.

However, I just verifed the database and it does not have the 'Compact on Close' Option checked.

Any other guess?

Thank you
 
Sorry.

I didn't hold out much hope for my earlier guess. I can't replicate your problem and I'm afraid I don't really have any other ideas.

Is there any code in the database that may be causing the problem? - Again just clutching at straws!
 
If it helps, I have seen a similar problem when starting an Access 2000 database from a Desktop shortcut, on a Windows 2000 machine. The same error message 'Cannot find the file ...' etc is displayed, but when you clear this message the database opens normally.

My database is also stored on a network drive, so I wonder if there is a timing problem here? e.g. Windows is still looking for the file along the network path, when the error message is trigered.

Do you see the same problem if you open a local C: drive copy of your database?



Bob Stubbs
 
Hi,

No, I do not get a similar error when I open a local copy of the database, also do not get a error when I open the c:\..\arisdb.mdb from Command prompt.

However when I try to open the network version via command promt, I get the error "The system cannot execute the specified program."

What next ?

Thanks,
Hat666
 
Have you applied the Service Packs to Office / Access 2000 ?

If so, what Service Pack number are you running?

I can't find any reference to the error in the Microsoft knowledge base, so I'm wondering if it is something which has been fixed by SP3 (the level that I have installed).


Bob Stubbs
 
Hats666,
You might try, instead of starting the mdb, starting msaccess.exe, with the mdb as a command line argument.

We open databases so frequently by double-clicking the mdb or via links, that it is easy to forget that there is actually an application under there (msaccess.exe), which we're really dealing with.

See the Command() function and "Startup Command Line Options" in Help for a good presentation of the possible arguments/functionality.

Tranman

"Adam was not alone in the Garden of Eden, however,...much is due to Eve, the first woman, and Satan, the first consultant."
Mark Twain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top