Access.2007.VBA.Bibl..

(John Hannent) #1

The SaveNoand BackEndSaveNofunctions create an incremented number for the database (or
back-end database) copies:


Public Function SaveNo() As String
‘Called from BackupFrontEnd()

On Error GoTo ErrorHandler

Create a unique incrementing save number for today:


intDayNo = Nz(DMax(“[SaveNumber]”, “zstblBackupInfo”, _
“[SaveDate] = Date()”))
Debug.Print “Day no. “ & intDayNo
strNextNo = CStr(intDayNo + 1)
Debug.Print “Next No. “ & strNextNo
SaveNo = strNextNo

ErrorHandlerExit:
Exit Function

ErrorHandler:
MsgBox “Error No: “ & err.Number & “; Description: “ & _
err.Description
Resume ErrorHandlerExit

End Function

Public Function BackEndSaveNo() As String
‘Called from BackupBackEnd()

On Error GoTo ErrorHandler

Create a unique save number for today:


intDayNo = Nz(DMax(“[BackEndSaveNumber]”, _
“zstblBackupInfo”, _
“[BackEndSaveDate] = Date()”))
Debug.Print “Back end Day no. “ & intDayNo
strNextNo = CStr(intDayNo + 1)
Debug.Print “Back end Next No. “ & strNextNo
BackEndSaveNo = strNextNo

ErrorHandlerExit:
Exit Function

ErrorHandler:
MsgBox “Error No: “ & err.Number & “; Description: “ & _
err.Description
Resume ErrorHandlerExit

End Function

Creating Access Add-ins 14

Free download pdf