tio adjie,
weekend begini lagi males buat utak-atik kode ini :)
pada intinya sih, kode ini menjalankan perintah :

buat database baru
CreateDatabase strFileName, dbLangGeneral

lalu copy semua obyek tabel yang masuk dalam daftar, dalam hal ini array variable, ke database baru tersebut:
   For i = 0 To intLastTableToBackup
       strTblName = strTablesToBackup(i)
       DoCmd.CopyObject strFileName, strTblName, acTable, strTblName
   Next i

ayo, yang nangkap maksud dari kode ini bisa berkarya dikit dong untuk nolongin mas tio adjie dengan problemnya, bikinin aplikasi kecil2an untuk salin tabel ke backup file mdb baru.
ayo ..... ayo ....


aksan kurdin




[email protected] wrote:

Mas Aksan dan rekan milis Access lainnya. Ma'af baru reply :

Ini complete functionnya :

Bisakah secara detail bagaimana memanggilnya dari suatu form ?

Terima kasih sebelumnya.
Salam,
Tio

Option Compare Database
Private Const strDefaultBackupFile = "MasterDatabase.mdb"
Private Const strBackupExtension = ".mdb"

Private Const strTmpTable = "tblTempRestore"

Private strTablesToBackup(0 To 16) As String ' initialized below
Private strFirstVersion(0 To 16) As String ' initialized below
Private Const intLastTableToBackup = 16 ' includes version table
Private Const intLastTableToRestore = 15 ' does not include version table --
   ' we back it up but don't restore it, the version goes with the
   ' software
Private Const intVersionTableIndex = 16
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




        *Aksan Kurdin <[email protected]>*
Sent by: [email protected]

01/20/2010 05:24 PM
Please respond to belajar-access

To: [email protected] cc: Subject: Re: [belajar-access] Back Up Database




Procedure berikut yang digunakan dalam fungsi dobackup adalah user defined, dan tidak ditemukan, coba copy paste isi dari function:

Initialize
GetFileName

Juga beberapa variabel tampaknya di deklarasikan public atau berada di bagian deklarasi dalam modul yang sama, seperti strDefaultBackupFile, strBackupExtension, intLastTableToBackup,strTablesToBackup(i)
_
[email protected]_ <mailto:[email protected]> wrote:

Agar bisa dites bersama, tolong sertakan fungsi lengkapnya.


aksan kurdin




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.
===========================================================================


=========================================================================== 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. ===========================================================================


Kirim email ke