ballbearing
Technical User
This function in StartUp.mdb will compact and repair a defined database. Actually it does a great job too, btw. Anyway..here's my question: Since Access prefers to look at 'MyDocuments' all the time, some users place databases into different drives, directories, etc., I have a form which they can locate and select the database. The resulting path is then displayed in the form's textbox "txtOpenFile". This value is also placed into a table called "FilePath" for future reference. Clear as mud, right? What I'm having trouble with is figuring out how to place either the form's vale or (preferably) the table's value into the function below:
Function CompactDatabaseX()
Dim stappname As String
'Delete the last temporary compacted database
If Dir("compacted.mdb"
<> "" Then
Kill "compacted.mdb"
End If
'Compact database.
DBEngine.CompactDatabase "[form1!textopenfile]", "textopenfile"
'Rename database back to "original.mdb"
FileCopy "compacted.mdb", "Newtlc.mdb"
'Launch newly compacted database
stappname = "MSAccess.exe " & "Newtlc.mdb"
Call Shell(stappname, 1)
'Close the StartUp Database
DoCmd.Quit
End Function
I need a nudge in the right direction.
Thanks!
Gawd I love this Access stuff..too bad I don't know what I'm doing.
Function CompactDatabaseX()
Dim stappname As String
'Delete the last temporary compacted database
If Dir("compacted.mdb"
Kill "compacted.mdb"
End If
'Compact database.
DBEngine.CompactDatabase "[form1!textopenfile]", "textopenfile"
'Rename database back to "original.mdb"
FileCopy "compacted.mdb", "Newtlc.mdb"
'Launch newly compacted database
stappname = "MSAccess.exe " & "Newtlc.mdb"
Call Shell(stappname, 1)
'Close the StartUp Database
DoCmd.Quit
End Function
I need a nudge in the right direction.
Thanks!
Gawd I love this Access stuff..too bad I don't know what I'm doing.