Dear Pakar Access,
Saya dapat kode ini dari internet, tapi kenapa ya tidak bisa saya panggil
dari suatu form. Form ini saya namakan FRMBackup. Maksud saya adalah saya
ingin memback up Database dari suatu form.
Terima kasih sebelumnya.
Tio
Public Function DoBackUp()
' Prompts user for backup location, and backs up database tables
' This is a function so that it can be run directly from a menu
Dim strFileName As String
Dim strTblName As Variant
Dim i As Integer
On Error GoTo endsub
Initialize
' Ask user to choose file name
strFileName = GetFileName(strDefaultBackupFile, _
"DatabaseSekolah (*" & strBackupExtension & ")" & vbNullChar & _
"*" & strBackupExtension & vbNullChar, _
"Back up database to...", 1, 47)
If (strFileName = "") Then
' user cancelled
Exit Function
End If
' create new MDB database file
DoCmd.Hourglass True
CreateDatabase strFileName, dbLangGeneral
Form_FRMBackup.Refresh
' save all tables to backup database, except system objects
For i = 0 To intLastTableToBackup
strTblName = strTablesToBackup(i)
DoCmd.CopyObject strFileName, strTblName, acTable, strTblName
Next i
DoCmd.Hourglass False
MsgBox "Backup Database Berhasil", , "Backup Database"
Exit Function
endsub:
DoCmd.Hourglass False
DisplayError "backup", Err.Description
End Function
===========================================================================
This email is confidential. If you are not the addressee tell the sender
immediately and destroy this email without using, sending or storing it.
Emails are not secure and may suffer errors, viruses, delay, interception
and amendment. The Trakindo Group of Companies do not accept liability for
damage caused by this email and may monitor email traffic.
Unless expressly stated, any opinions are the sender's and are not approved
by the Tiara Marga Trakindo Group of Companies and this email is not an
offer, solicitation, recommendation or agreement of any kind.
===========================================================================