OIC... now I understand what you are saying. It is in it's own module, not in the class objects. I still get the same error. Here is my code on the form... followed by the code for the actual function. How and where do I set a reference to the "Microsoft scripting runtime"?
Private Sub btn_Exit_Click()
On Error GoTo Err_btn_Exit_Click
newDB <<< What is this???
If Me.Dirty Then Me.Dirty = False
DoCmd.Quit
Exit_btn_Exit_Click:
Exit Sub
Err_btn_Exit_Click:
MsgBox Err.Description
Resume Exit_btn_Exit_Click
End Sub
...And the following function is not complete!
Option Compare Database
Public Function BackupCopy()
'This function will allow you to copy a db that is open,
'You must set a reference to the 'Microsoft Scripting Runtime' for the CopyFile piece to work!
Dim fso As FileSystemObject
Dim sSourcePath As String
Dim sSourceFile As String
Dim sBackupPath As String
Dim sBackupFile As String
sSourcePath = "E:\"
sSourceFile = "training database.mdb"
sBackupPath = "E:\work stuff\"
sBackupFile = "BackupDB_" & Format(Date, "mmddyyyy") & "_" & Format(Time, "hhmmss") & ".mdb"
Set fso = New FileSystemObject
fso.CopyFile sSourcePath & sSourceFile, sBackupPath & sBackupFile, True
Set fso = Nothing
Beep
MsgBox "Backup was successful and saved @ " & Chr(13) & Chr(13) & sBackupPath & Chr(13) & Chr(13) & "The backup file name is " & Chr(13) & Chr(13) & sBackupFile, vbInformation, "Backup Completed"