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

Tidak ada komentar:

Posting Komentar