Share via

Copy an Access database when open using command button

Anonymous
2012-01-05T23:39:28+00:00

Hi,

Is it possible to open an Access database, add records, change data or whatever and then have a command button in the program that would ask for a drive letter (ie C:, D: .....) and then copy the opened database to the entered drive?  If so, would the change be saved?  Also, if this is possible, how?

Thanks

Phil

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-01-06T00:42:03+00:00

Depends on what you're trying to do.

All Access applications (even single-user applications!) should be split into a front-end (containing the queries, forms, reports, macros and modules) linked to a back-end (containing the tables and relations). If you ensure that there's no connection to the back-end (i.e.: no bound forms or reports are open), you should be able to copy the back-end using the built-in VBA FileCopy statement.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

Answer accepted by question author

Anonymous
2012-01-06T00:53:05+00:00

Just to briefly add to Douglas' answer.

For the FileCopy to work, as dougls states, need to be done when there are no active connection to the database.  Hence you can use DIR statement to check for a lock file (ldb, laacdb, ...) in the database directory, if none exists then it is safe to make the copy, otherwise, it means someone is actively in the database and a copy should be made at another time.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful