Sub aktiftombol()
simpan.Visible = True: batal.Visible = True
Tambah.Visible = False: edit.Visible = False: hapus.Visible = False: keluar.Visible = False
End Sub
Sub nonaktiftombol()
simpan.Visible = False: batal.Visible = False
Tambah.Visible = True: edit.Visible = True: hapus.Visible = True: keluar.Visible = True
End Sub
Sub nonaktiftext()
On Error Resume Next
a.Enabled = False: b.Enabled = False: c.Enabled = False
d.Enabled = False: e.Enabled = False: f.Enabled = False
g.Enabled = False: h.Enabled = False: i.Enabled = False: j.Enabled = False
k.Enabled = False: l.Enabled = False: m.Enabled = False
n.Enabled = False: o.Enabled = False: p.Enabled = False
End Sub
Private Sub Form_UnLoad(Cancel As Integer)
Call keluarform
End Sub
Private Sub Tambah_Click()
Call aktiftombol
Koneksi.Recordset.AddNew
DataGrid1.Enabled = False
a.Enabled = True: a.SetFocus
End Sub
Private Sub edit_Click()
If Koneksi.Recordset.BOF Then
MsgBox "data yang di edit tidak ada", vbInformation, "konrirmasi program"
Tambah.SetFocus
Else
Call aktiftombol
DataGrid1.Enabled = False
a.Enabled = True: a.SetFocus
End If
End Sub
Private Sub hapus_Click()
If Koneksi.Recordset.EOF Then
MsgBox "Data Yang Dihapus Tidak ada,,,!!!", vbCritical, "Konfirmasi program"
Tambah.SetFocus
Exit Sub
End If
pesan = MsgBox("Apakah anda Yakin Menghapus Data Ini,,,?", vbQuestion + vbYesNo, "Konfirmasi Program")
If pesan = vbYes Then
On errr GoTo salah
Koneksi.Recordset.Delete adAffectCurrent
Koneksi.Recordset.MoveFirst
Exit Sub
End If
On Error GoTo 0
Exit Sub
salah:
MsgBox "Data Yang Dihapus Tidak ada,,,!!!", vbCritical, "Konfirmasi program"
Tambah.SetFocus
End Sub
Private Sub keluar_Click()
Call keluarform
End Sub
Private Sub batal_Click()
Call nonaktiftombol
Call nonaktiftext
Koneksi.Refresh
DataGrid1.Enabled = True
Tambah.SetFocus
End Sub
Private Sub simpan_Click()
On Error GoTo salah
If a = " " Or b = "" Or c = " " Then
MsgBox "lengkapi dulu data yang kosong", vbCritical, "Konfirmasi program"
Text1.SetFocus
Exit Sub
End If
Koneksi.Recordset.Update
Koneksi.Recordset.MoveLast
Call nonaktiftext
Call nonaktiftombol
DataGrid1.Enabled = True
Exit Sub
On Error GoTo 0
salah:
MsgBox "Kode Dosen sudah ada silahkan ganti dengan Kode Dosen lain Dengan lima Krakter,,!!", vbCritical, "konfirmasi program"
a.SetFocus
End Sub
Private Sub a_keypress(keyascii As Integer)
If keyascii = 13 Then
If a = "" Then
MsgBox "Lengkapi dulu data yang kosong", vbCritical, "Konfirmasi program"
a.SetFocus
Else
b.Enabled = True: b.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub b_keypress(keyascii As Integer)
If keyascii = 13 Then
If b = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
b.SetFocus
Else
c.Enabled = True: c.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub c_keypress(keyascii As Integer)
If keyascii = 13 Then
If c = "" Then
MsgBox "isi dulu data yang kosong", vbInformation, "konfirmasi program"
c.SetFocus
Else
d.Enabled = True: d.SetFocus
End If
End If
End Sub
Private Sub d_keypress(keyascii As Integer)
If keyascii = 13 Then
If d = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
d.SetFocus
Else
e.Enabled = True: e.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub e_keypress(keyascii As Integer)
If keyascii = 13 Then
If e = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
e.SetFocus
Else
f.Enabled = True: f.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub f_keypress(keyascii As Integer)
If keyascii = 13 Then
If f = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
f.SetFocus
Else
g.Enabled = True: g.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub g_keypress(keyascii As Integer)
If keyascii = 13 Then
If g = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
g.SetFocus
Else
h.Enabled = True: h.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub h_keypress(keyascii As Integer)
If keyascii = 13 Then
If h = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
h.SetFocus
Else
i.Enabled = True: i.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub i_keypress(keyascii As Integer)
If keyascii = 13 Then
If i = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
i.SetFocus
Else
j.Enabled = True: j.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub j_keypress(keyascii As Integer)
If keyascii = 13 Then
If j = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
j.SetFocus
Else
k.Enabled = True: k.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub k_keypress(keyascii As Integer)
If keyascii = 13 Then
If k = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
k.SetFocus
Else
l.Enabled = True: l.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub l_keypress(keyascii As Integer)
If keyascii = 13 Then
If l = "" Then
MsgBox "isi dulu data yang kosong ", vbInformation, "konfirmasi program"
l.SetFocus
Else
m.Enabled = True: m.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub m_keypress(keyascii As Integer)
If keyascii = 13 Then
If m = "" Then
MsgBox "isi dulu data yang kosong", vbInformation, "konfirmasi program"
m.SetFocus
Else
simpan.SetFocus
End If
End If
End Sub
Sub keluarform()
Unload Me
End Sub
Read More..
Tampilkan postingan dengan label Jumat Soscode Data Dosen. Tampilkan semua postingan
Tampilkan postingan dengan label Jumat Soscode Data Dosen. Tampilkan semua postingan
Jum"at 3 juli Nb Ta Soscode Data Dosen
Diposting oleh
club jojoba
on Kamis, 02 Juli 2009
Label:
Jumat Soscode Data Dosen
/
Comments: (0)
