khafie zblatzzblayy
Selasa, 24 Januari 2012
form register 1
Private Sub b1_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
Call msgSimpan
Else
Adodc1.Recordset.Update
Adodc1.Refresh
Call nonaktif
b1.Enabled = False
b4.Caption = "Keluar"
End If
End Sub
Private Sub b2_Click()
If b2.Caption = "Edit" Then
Call aktif
b2.Caption = "Simpan"
b4.Caption = "Batal"
b1.Enabled = False
b3.Enabled = False
ElseIf b2.Caption = "Simpan" Then
If Adodc1.Recordset.RecordCount = 0 Then
Call msgKosong
Else
Adodc1.Recordset.Update
Adodc1.Refresh
b2.Caption = "Edit"
b4.Caption = "Keluar"
b1.Enabled = True
b3.Enabled = True
Call nonaktif
End If
End If
End Sub
Private Sub b3_Click()
If Adodc1.Recordset.RecordCount = 0 Then
Call msgKosong
Else
pesan = MsgBox("Yakin data ini akan anda hapus?", vbYesNo, "Konfirmasi")
If pesan = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Refresh
End If
End If
End Sub
Private Sub b4_Click()
If b4.Caption = "Keluar" Then
Unload Me
frmUtama.Show
frmUtama.Enabled = True
ElseIf b4.Caption = "Batal" Then
Adodc1.Refresh
Call nonaktif
b1.Enabled = False
b4.Caption = "Keluar"
End If
End Sub
Private Sub Form_Load()
Adodc1.Recordset.AddNew
Combo1.Text = "User"
b4.Caption = "Batal"
c1.Value = 0
c2.Value = 0
c3.Value = 0
c4.Value = 0
c5.Value = 0
c6.Value = 0
c7.Value = 0
End Sub
Private Sub aktif()
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
Combo1.Enabled = True
End Sub
Private Sub nonaktif()
Text1.Locked = True
Text2.Locked = True
Text3.Locked = True
Text4.Locked = True
Text5.Locked = True
Combo1.Enabled = False
End Sub
form register
Private Sub b_Click()
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "Username atau Password belum diisi!", vbInformation, "Register"
Else
If Adodc1.Recordset.EOF Then
pesan = MsgBox("Akun Tersedia, mau di lanjutkan?", vbYesNo, "Register")
If pesan = vbYes Then
frmRegister1.Text1.Text = Text1.Text
frmRegister1.Text2.Text = Text2.Text
frmRegister1.Show
Unload Me
End If
Else
MsgBox "Akun tidak tersedia, silahklan gunakan username lain!", vbYesNo, "Register"
Text1.Text = ""
Text2.Text = ""
End If
End If
End Sub
Private Sub bb_Click()
Unload Me
frmUtama.Show
frmUtama.Enabled = True
End Sub
Private Sub Text1_Change()
Dim r As String
r = "select * from login where username like'" & Text1.Text & "'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = r
Adodc1.Refresh
End Sub
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
form barang baru
Private Sub b1_Click()
If b1.Caption = "Tambah" Then
b1.Caption = "Simpan"
Adodc1.Recordset.AddNew
Call aktif
b2.Enabled = False
b3.Enabled = False
b4.Caption = "Batal"
ElseIf b1.Caption = "Simpan" Then
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
Call msgSimpan
Else
Adodc1.Recordset.Update
Adodc1.Refresh
Call nonaktif
b1.Caption = "Tambah"
b4.Caption = "Keluar"
End If
End If
End Sub
Private Sub b2_Click()
If b2.Caption = "Edit" Then
Call aktif
b2.Caption = "Simpan"
b4.Caption = "Batal"
b1.Enabled = False
b3.Enabled = False
ElseIf b2.Caption = "Simpan" Then
If Adodc1.Recordset.RecordCount = 0 Then
Call msgKosong
Else
Adodc1.Recordset.Update
Adodc1.Refresh
b2.Caption = "Edit"
b4.Caption = "Keluar"
Call nonaktif
End If
End If
End Sub
Private Sub b3_Click()
If Adodc1.Recordset.RecordCount = 0 Then
Call msgKosong
Else
pesan = MsgBox("Yakin data ini akan anda hapus?", vbYesNo, "Konfirmasi")
If pesan = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Refresh
End If
End If
End Sub
Private Sub b4_Click()
If b4.Caption = "Keluar" Then
Unload Me
frmUtama.Show
frmUtama.Enabled = True
ElseIf b4.Caption = "Batal" Then
Adodc1.Refresh
Call nonaktif
b1.Caption = "Tambah"
b2.Caption = "Edit"
b3.Caption = "Hapus"
b4.Caption = "Keluar"
' b1.Enabled = True
' b2.Enabled = True
' b3.Enabled = True
End If
End Sub
Private Sub c1_Click()
If Adodc1.Recordset.RecordCount = 0 Then
Call msgKosong
Else
Adodc1.Recordset.MoveFirst
End If
End Sub
Private Sub c2_Click()
If Adodc1.Recordset.RecordCount = 0 Then
Call msgKosong
Else
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
End If
End If
End Sub
Private Sub c3_Click()
If Adodc1.Recordset.RecordCount = 0 Then
Call msgKosong
Else
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveLast
End If
End If
End Sub
Private Sub c4_Click()
If Adodc1.Recordset.RecordCount = 0 Then
Call msgKosong
Else
Adodc1.Recordset.MoveLast
End If
End Sub
Private Sub Form_Load()
Dim u As String
Adodc1.Visible = False
Call nonaktif
End Sub
Private Sub aktif()
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
End Sub
Private Sub nonaktif()
Text1.Locked = True
Text2.Locked = True
Text3.Locked = True
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
'If Not (KeyAscii >= ("0") And KeyAscii <= ("9") Or KeyAscii = vbKeyBack) Then
' MsgBox "Hanya bisa diinput dengan angka!", vbInformation, "Info"
'End If
' KeyAscii = 0
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
'If Not (KeyAscii >= ("0") And KeyAscii <= ("9") Or KeyAscii = vbKeyBack) Then
' MsgBox "Hanya bisa diinput dengan angka!", vbInformation, "Info"
' KeyAscii = 0
'End If
End Sub
Private Sub Text4_Change()
Dim u As String
u = "select * from barang where nama_brg like'%" & Text4.Text & "%'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = u
Adodc1.Refresh
End Sub
Senin, 23 Januari 2012
script cari berdasarkan nama
Dim u As String
u = "select * from customer where nama_cust like'%" & Text4.Text & "%'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = u
Adodc1.Refresh
form barang
Private Sub add_Click()
Adodc2.Recordset.AddNew
Text1.SetFocus
save.Enabled = True
add.Enabled = False
delete.Enabled = False
edit.Enabled = False
Keluar.Enabled = False
End Sub
Private Sub Command1_Click()
Adodc2.Refresh
End Sub
Private Sub datacustomer_Click()
Form1.Show
Unload Me
End Sub
Private Sub DataGrid2_Click()
edit.Enabled = True
End Sub
Private Sub delete_Click()
Adodc2.Recordset.delete
Adodc2.Refresh
Adodc2.Recordset.MoveFirst
save.Enabled = False
add.Enabled = True
delete.Enabled = True
edit.Enabled = True
Keluar.Enabled = True
End Sub
Private Sub edit_Click()
Adodc2.Recordset.Update
save.Enabled = True
add.Enabled = True
delete.Enabled = True
edit.Enabled = False
Keluar.Enabled = True
End Sub
Private Sub Form_Activate()
save.Enabled = False
add.Enabled = True
delete.Enabled = True
edit.Enabled = False
Keluar.Enabled = True
End Sub
Private Sub keluar_Click()
If MsgBox("yakin mau keluar ??", vbOKCancel + vbCritical, "WARNING !") = vbOK Then
Form3.Show
Else
End If
End Sub
Private Sub save_Click()
Adodc2.Recordset.save
save.Enabled = False
add.Enabled = True
delete.Enabled = True
edit.Enabled = True
Keluar.Enabled = True
End Sub
Private Sub Timer1_Timer()
Label7.Caption = Format(Time)
End Sub
form data customer
Private Sub add_Click()
Adodc1.Recordset.AddNew
Text2.SetFocus
save.Enabled = True
add.Enabled = False
delete.Enabled = False
edit.Enabled = False
keluar.Enabled = False
End Sub
Private Sub Command1_Click()
Adodc1.Refresh
End Sub
Private Sub databarang_Click()
Form2.Show
Unload Me
End Sub
Private Sub DataGrid1_Click()
edit.Enabled = True
End Sub
Private Sub delete_Click()
Adodc1.Recordset.delete
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
save.Enabled = False
add.Enabled = True
delete.Enabled = True
edit.Enabled = True
keluar.Enabled = True
End Sub
Private Sub edit_Click()
Adodc1.Recordset.Update
save.Enabled = True
add.Enabled = True
delete.Enabled = True
edit.Enabled = False
keluar.Enabled = True
End Sub
Private Sub Form_Activate()
save.Enabled = False
add.Enabled = True
delete.Enabled = True
edit.Enabled = False
keluar.Enabled = True
End Sub
Private Sub keluar_Click()
If MsgBox("yakin mau keluar ??", vbOKCancel + vbCritical, "WARNING !") = vbOK Then
Form3.Show
Else
End If
End Sub
Private Sub save_Click()
Adodc1.Recordset.Update
save.Enabled = False
add.Enabled = True
delete.Enabled = True
edit.Enabled = True
keluar.Enabled = True
End Sub
Private Sub Timer1_Timer()
Label7.Caption = Format(Time)
End Sub
Langganan:
Postingan (Atom)