Selasa, 24 Januari 2012

form backup baru










Private Sub xit_Click()
frmUtama.Show
frmUtama.Enabled = True
Unload Me
End Sub

Private Sub p1_Click()
With cdg
    .InitDir = "\\Server_lab\"
    .Filter = "Database SQL Server (*.mdf)|*.mdf"
    .DialogTitle = "Cari Database"
    .ShowOpen
End With
txtfile1.Text = cdg.FileTitle
txtlok1.Text = cdg.FileName
p2.Enabled = True
xit.Enabled = False
End Sub

Private Sub p2_Click()
With cdg
    .InitDir = "C:\"
    .FileName = ""
    .Filter = "Database SQL Server (*.mdf)|*.mdf"
    .DialogTitle = "Simpan dengan nama"
    .ShowSave
End With
txtfile2.Text = cdg.FileTitle
txtlok2.Text = cdg.FileName
Proses.Enabled = True
End Sub

Private Sub p3_Click()
With cdg
    .InitDir = "\\Server_lab\"
    .Filter = "Database SQL Server (*.ldf)|*.ldf"
    .DialogTitle = "Cari Database"
    .ShowOpen
End With
Text1.Text = cdg.FileTitle
Text2.Text = cdg.FileName
p4.Enabled = True
End Sub

Private Sub p4_Click()
With cdg
    .InitDir = "C:\"
    .FileName = ""
    .Filter = "Database SQL Server (*.ldf)|*.ldf"
    .DialogTitle = "Simpan dengan nama"
    .ShowSave
End With
Text.Text = cdg.FileTitle
Text3.Text = cdg.FileName
Proses.Visible = f
Proses2.Enabled = True
End Sub

Private Sub Proses_Click()
Dim jawab As Integer
Dim dirAwal, dirAkhir
jawab = MsgBox("Yakin melakukan backup?", vbYesNo + vbQuestion, "Konfirmasi")
If jawab = 6 Then
    dirAwal = Trim(txtlok1.Text)
    dirAkhir = Trim(txtlok2.Text)
    p3.Enabled = True
    Proses.Visible = False
    Frame1.Visible = False
    Frame2.Visible = False
    Frame3.Visible = True
    Frame4.Visible = True
    On Error GoTo perbaikan
    FileCopy dirAwal, dirAkhir
    MsgBox "Proses backup berhasil!", vbInformation, "Informasi"
    Exit Sub
perbaikan:
MsgBox "Ada kesalahan [" & Err.Description & "]backup tidak dilanjutkan.", vbOKOnly + vbExclamation, "Error"
End If
End Sub

Private Sub Proses2_Click()
Dim jawab As Integer
Dim dirAwal, dirAkhir
jawab = MsgBox("Yakin melakukan backup?", vbYesNo + vbQuestion, "Konfirmasi")
If jawab = 6 Then
    dirAwal = Trim(Text2.Text)
    dirAkhir = Trim(Text3.Text)
    xit.Enabled = True
    On Error GoTo perbaikan
    FileCopy dirAwal, dirAkhir
    MsgBox "Proses backup berhasil!", vbInformation, "Informasi"
    Exit Sub
perbaikan:
MsgBox "Ada kesalahan [" & Err.Description & "]backup tidak dilanjutkan.", vbOKOnly + vbExclamation, "Error"
End If
End Sub

Tidak ada komentar:

Posting Komentar