Hi group!
I can really use some help! I've got a database that I've created that needs to be compacted on a regular basis (large record imports and deletes). So I've created another database (Compact.mdb) from where I will compact and repair the Master DB in this case MrkDB.mdb. I've written the code listed below to open the Compact.mdb. but I can't figure out how to close MrkDB.mdb? Further, I would like to delete the old MrkDB.mdb and rename the newly compacted databse with the same old name! That way my users shortcuts will still work. Am I asking too much? Please keep in mind that I'm a VBA wanna be! I just can't fint the right answers in any of my numerous Access VBA books!
Option Compare Database
Option Explicit
Dim appAccess As Access.Application
Function OpenDB()
Dim strDB As String
strDB = "C:\MrkDB\Compact.mdb "
Set appAccess = CreateObject("Access.Application.8"
appAccess.OpenCurrentDatabase strDB
appAccess.DoCmd.OpenForm "frmCompact", acNormal, , , , acWindowNormal
End Function
I can really use some help! I've got a database that I've created that needs to be compacted on a regular basis (large record imports and deletes). So I've created another database (Compact.mdb) from where I will compact and repair the Master DB in this case MrkDB.mdb. I've written the code listed below to open the Compact.mdb. but I can't figure out how to close MrkDB.mdb? Further, I would like to delete the old MrkDB.mdb and rename the newly compacted databse with the same old name! That way my users shortcuts will still work. Am I asking too much? Please keep in mind that I'm a VBA wanna be! I just can't fint the right answers in any of my numerous Access VBA books!
Option Compare Database
Option Explicit
Dim appAccess As Access.Application
Function OpenDB()
Dim strDB As String
strDB = "C:\MrkDB\Compact.mdb "
Set appAccess = CreateObject("Access.Application.8"
appAccess.OpenCurrentDatabase strDB
appAccess.DoCmd.OpenForm "frmCompact", acNormal, , , , acWindowNormal
End Function