I've got this for saving my backend to a floppy. It uses the compact and repair procedure before saving the database, maybe you can adapt it.
stdresponse = MsgBox("The database will backup you data to drive A." & vbCr & vbCr & _
"Please wait a moment....", vbOKCancel)
If stdresponse = vbOK Then
DBEngine.CompactDatabase "C:\Program Files\Mailing Database\Mailing Database_be.mdb", "C:\Program Files\Mailing Database\Mailing Database_be1.mdb"
Kill "C:\Program Files\Mailing Database\Mailing Database_be.mdb"
Name "C:\Program Files\Mailing Database\Mailing Database_be1.mdb" As "C:\Program Files\Mailing Database\Mailing Database_be.mdb"
'Remove the file from the floppy or so the code can save the data
If Dir("A:\Mailing Database_be.mdb") <> "" Then Kill "A:\Mailing Database_be.mdb"
DBEngine.CompactDatabase "C:\Program Files\Mailing Database\Mailing Database_be.mdb", "A:\Mailing Database_be.mdb"
End If
I've left my own file paths in there but obviously you would need to change that to suit. Many thanks to Jack Cowley for the code in the first place.
HTH