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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

databases controlling databases 1

Status
Not open for further replies.

blarson0

Programmer
Jun 12, 2002
85
US
Hi! I am making a module in a database that will back up several other databases, as well as compressing them, deleting old records, making .MDE files, etc.

To delete the old records, should I run code from the backup module, or would it be better to have that module open the database to be backed up and start a module in it. If I have the individual databases delete their own old records, how can I have my backup database know when they are done?

I've never worked with more then one database at a time, so any help here would really be appreciated.

Thanks!

-Brad
 
Personally I would have the backup & file maintenance routines done in the file mainenance database, that way there is no chance of a user finding the delete queries and "finding out what they do!"

It's pretty simple: (this is all done in DAO. If using access 2000 or xp then you need to make sure your reference to DAO is set.

Dim dbExternal as DAO.Database
set dbexternal=opendatabase("C:\Databases\Database1.mde")
dbExternal.Execute "DELETE * FROM tblData WHERE tblData.Entrydate Is Null;")
etc...

Hope that gets you started.

B ----------------------------------
Ben O'Hara
bo104@westyorkshire.pnn.police.uk
----------------------------------
 
wow... that will really help! Thanks Ben!

Can I run commands other then SQL using this method? I could probably get everything done in SQL, but just in case...

Thanks again!

-Brad
 
AFAIK, anything you can do in CurrentDB you can do in dbExternal. Create tables, open recordsets, delete things, no problem.

Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.pnn.police.uk
----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top