Batch Files in Access

D

DS

Any way to run a Batch file in access? I want to create a Backup screen
in access that goes to a the DOS window and runs a Batch fiel. Has
anyone ever tried this? Thanks.
DS
 
M

Marshall Barton

DS said:
Any way to run a Batch file in access? I want to create a Backup screen
in access that goes to a the DOS window and runs a Batch fiel. Has
anyone ever tried this?


Check Help on the Shell function.
 
D

DS

Marshall said:
DS wrote:





Check Help on the Shell function.
Great! Thank you. I have the batch file working out of Access. The
only thing is that you are suppose to close Access or at least the
Database when backing up. Any way to incorperate that into the batch
file or VB?
Thank you,
DS
 
M

Marshall Barton

DS said:
Great! Thank you. I have the batch file working out of Access. The
only thing is that you are suppose to close Access or at least the
Database when backing up. Any way to incorperate that into the batch
file or VB?


I'm sorry, I missed the point about using the batch script
to back up the database. This is a very tricky situation,
in that if you have the standard split arrangement with
multiple users, you can not be sure the back end mdb is (and
will remain) closed.

If you do not allow for mulltiple users, then it's possible
if you make sure the front end has closed all references
(forms, queries, recordsets, etc) to the linked tables.

If your db is not split, I am unaware of any way to do this.

My bottom line is that backing up a daabase is defintely a
separate task that should be performed by a person with the
where-with-all to make sure the db is closed before doing
the copy.
 
D

DS

Marshall said:
I'm sorry, I missed the point about using the batch script
to back up the database. This is a very tricky situation,
in that if you have the standard split arrangement with
multiple users, you can not be sure the back end mdb is (and
will remain) closed.

If you do not allow for mulltiple users, then it's possible
if you make sure the front end has closed all references
(forms, queries, recordsets, etc) to the linked tables.

If your db is not split, I am unaware of any way to do this.

My bottom line is that backing up a daabase is defintely a
separate task that should be performed by a person with the
where-with-all to make sure the db is closed before doing
the copy.
Hi,
Its not a split Database. I have the thing working except that the DOS
window won't close. Know of any commands that would close it?
Thanks
DS
 
M

Marshall Barton

DS said:
Its not a split Database. I have the thing working except that the DOS
window won't close. Know of any commands that would close it?


You mean that the batch script launches and your application
closes before the script gets to the Copy command? This
seems rather unlikely to me, but if you've figured out a way
to do that, please let me know how you did it. If you don't
have that degree of synchronization, then you don't really
have it working.

Just because the DOS Copy command doesn't check for the file
being open doesn't mean it can make a viable copy of a your
database. It might work sometimes, but it's quite possible
for the database to be in an indeterminate state when the
copy is made. You will never know if the copy can actually
be used or even if it can be opened, that it has a
consistent set of data. There is a very good reason why the
Access backup procedure (and the FileCopy statement) will
not operate on an open file.

You can close the DOS window by using the Exit command at
the end of the batch script.
 
D

DS

Marshall said:
You mean that the batch script launches and your application
closes before the script gets to the Copy command? This
seems rather unlikely to me, but if you've figured out a way
to do that, please let me know how you did it. If you don't
have that degree of synchronization, then you don't really
have it working.

Just because the DOS Copy command doesn't check for the file
being open doesn't mean it can make a viable copy of a your
database. It might work sometimes, but it's quite possible
for the database to be in an indeterminate state when the
copy is made. You will never know if the copy can actually
be used or even if it can be opened, that it has a
consistent set of data. There is a very good reason why the
Access backup procedure (and the FileCopy statement) will
not operate on an open file.

You can close the DOS window by using the Exit command at
the end of the batch script.
Yeah, It works. I tested my Back-Up copies and they are good. I built
a form in access. You click on a button. Access shells out to the DOS
prompt, Access closes, the copy is made. And the Batch file reopens
Access, Walluh.
Thanks for your help.
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top