ini contoh program pendaftaran menggunakan databse dari Ms.Access...
untuk isi tabel beserta fields dan recordnya,hanya menggunakan 1 tabel. dan program ini adalah program transaksi one to one.
copas listingnya nih....
untuk isi tabel beserta fields dan recordnya,hanya menggunakan 1 tabel. dan program ini adalah program transaksi one to one.
copas listingnya nih....
Sub bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Combo1.Text = ""
Option1(1).Value = False
Option1(0).Value = False
End Sub
Sub nonaktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Option1(1).Enabled = False
Option1(0).Enabled = False
Combo1.Enabled = False
End Sub
Sub aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Option1(1).Enabled = True
Option1(0).Enabled = True
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Combo1.Enabled = True
End Sub
Private Sub Command1_Click()
bersih
aktif
Text2.SetFocus
Adodc1.RecordSource = "select * from siswa order by 1"
Adodc1.Refresh
With Adodc1.Recordset
If .BOF And .EOF Then
Text1.Text = Format(Date, "yyyy") & "001"
Else
.MoveLast
Text1.Text = Format(Date, "yyyy") & _
Right(Str(Val(Right(!nis, 3)) + 11001), 3)
End If
End With
End Sub
Private Sub Command2_Click()
With Adodc1.Recordset
.AddNew
.Fields("nis") = Text1.Text
.Fields("nama") = Text2.Text
.Fields("alamat") = Text3.Text
If Option1(0).Value = True Then
.Fields("jkel") = "W"
ElseIf Option1(1).Value = True Then
.Fields("jkel") = "P"
End If
.Fields("agama") = Combo1.Text
.Fields("tgl_daftar") = Label8.Caption
.Update
End With
Grid1.Refresh
bersih
nonaktif
End Sub
Private Sub Command3_Click()
bersih
nonaktif
End Sub
Private Sub Command4_Click()
aktif
p = InputBox("masukan kode nis!!")
Adodc1.RecordSource = "select*from siswa where nis= '" & p & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
MsgBox ("Data tidak ditemukan")
Else
Text1.Text = Adodc1.Recordset!nis
Text2.Text = Adodc1.Recordset!nama
Text3.Text = Adodc1.Recordset!alamat
End If
Grid1.Refresh
End Sub
Private Sub Command5_Click()
aktif
p = InputBox("masukan data yang ingin di hapus")
Adodc1.RecordSource = "select*from siswa where nis= '" & p & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
MsgBox ("Data tidak ditemukan")
Else
Text1.Text = Adodc1.Recordset!nis
Text2.Text = Adodc1.Recordset!nama
Text3.Text = Adodc1.Recordset!alamat
End If
If MsgBox("yakin mau di hapus??", vbQuestion + vbYesNo) = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Refresh
Grid1.Refresh
bersih
End If
Grid1.Refresh
Adodc1.Refresh
Adodc1.RecordSource = "Select * from siswa"
End Sub
Private Sub Command6_Click()
If MsgBox("Anda Ingin Keluar?", vbYesNo + vbQuestion, "Info") = vbYes Then
Unload Me
End If
End Sub
Private Sub Form_Activate()
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = True
bersih
nonaktif
End Sub
Private Sub Timer1_Timer()
Label8.Caption = Date
End Sub
----------------------------------------
ini formnya...
selamat mencoba!!
Tidak ada komentar:
Posting Komentar