hello all, I'm New to Mr.Excel (Access too)
I get this message - The expression you entered has a function name that Microsoft Access can't find."
I copied the VB from a Mr.Excel video about "Auto BackUp" - I'm using 2007-2010
*I need help to resolve this error
I get this message - The expression you entered has a function name that Microsoft Access can't find."
I copied the VB from a Mr.Excel video about "Auto BackUp" - I'm using 2007-2010
*I need help to resolve this error
Code:
Sub BackUp()
Dim dTime As Date
On Error Resume Next
dTime = InputBox("Create a backup at", , Time + TimeValve("12:00:01"))
If Err.Number <> 0 Then Exit Sub
Do Until Time = dTime
DoEvents
Loop
'MsgBox "Time to create a backup"
Dim sFile As String, oDB As DAO.Database
sFile = CurrentProject.Path & "\" & Format(Date, "m-d-yy") & ".accdb"
If Dir(sFile) <> "" Then Kill sFile
Set oDB = DBEngine.Workspaces(0).CreateDatabase(sFile, dbLangGeneral)
oDB.Close
Dim oTD As TableDef
DoCmd.Hourglass True
For Each oTD In CurrentDb.TableDefs
If Left(oTD.Name, 4) <> "Msys" Then 'don't copy Msys tables
DoCmd.CopyObject sFile, , acTable, oTD.Name
End If
Next oTD
Dim oQD As QueryDef ' I added this section for queries
For Each oQD In CurrentDb.QueryDefs ' I added this section for queries
If Left(oQD.Name, 4) <> "Msys" Then 'don't copy Msys querys ' I added this section for queries
DoCmd.CopyObject sFile, , acQuery, oQD.Name ' I added this section for queries
End If ' I added this section for queries
Next oQD ' I added this section for queries
DoCmd.Hourglass False
MsgBox "Back up is stored in the same folder"End Sub
Function RunSub() ' I followed the instructions in the video to add this into existing autoexec macro
BackUp
End Function
[\code]