sub bersih()
txtnama.Text = ""
txtbayar.Text = 0
combobox.Text = ""
option1 = False
checkbox.Value = 0
Listbox.Clear
sub aktif()
.Enable = True
sub nonaktif()
.Enable = False
Untuk checkbox
if check1.value = 1 then
.........
else
.........
end if
Untuk option
if option1 = True then
option2 = False
else
.........
end if
Untuk Listbox
Listbox.Clear
Listbox.Add Item “....”
Untuk combobox(dibuat di form load)
Combobox.Add Item “.....”
Rumus Waktu
Jam = Time
Tgl = Format (Date, “dddd,dd – mmmm – yyyy”)
Cat: jam dan tgl adalah nama variabel (label, textbox dll)
Rumus Keluar
p = MsgBox("Yakin ingin keluar??", vbQuestion + vbYesNo,
"Informasi")
If p = vbYes Then
Unload Me
End If
Rumus Cari
1.
Pakai Index
a = InputBox("Ketik no. anggota yang akan dicari :",
"Pencarian")
dtanggota.Recordset.Index = "xno_anggota"
dtanggota.Recordset.Seek "=", a
If dtanggota.Recordset.NoMatch Then
MsgBox "data tidak ditemukan"
Else
txtna.Text = dtanggota.Recordset!no_anggota
End if
2.
Pakai alamat
dtfilm.Recordset.FindFirst "jnsfilm='" & txtjf.Text &
"'"
If dtfilm.Recordset.NoMatch Then
MsgBox "Data dengan
Jenis Musik " & txtjf.Text & " Tidak Ditemukan",
vbOKOnly + vbInformation, "Informasi"
Else
txtjf.Text =
dtfilm.Recordset!jnsfilm
end if
Rumus Simpan
With dtanggota.Recordset
.AddNew
!no_anggota = txtna.Text
.Update
End With
Rumus Edit
With dtanggota.Recordset
.Edit
!no_anggota = txtna.Text
.Update
End With
Rumus Hapus
p = MsgBox("Yakin ingin menghapus data ini ??", vbQuestion +
vbOKCancel, "Konfirmasi")
If p = vbOK Then
dtanggota.Recordset.Delete
End If
Rumus Tambah
If cmdtmbah.Caption = "&Tambah" Then
cmdtmbah.Caption = "&Batal"
bersih
Else
cmdtmbah.Caption = "&Tambah"
bersih
End If
Rumus Back
dtfilm.Recordset.MovePrevious
If dtfilm.Recordset.BOF Then
dtfilm.Recordset.MoveFirst
MsgBox "Data sudah ada
diawal record", vbOKOnly + vbCritical, "Informasi"
End If
Rumus Next
dtfilm.Recordset.MoveNext
If dtfilm.Recordset.EOF Then
dtfilm.Recordset.MoveLast
MsgBox "Data sudah ada
diakhir record", vbOKOnly + vbCritical, "Informasi"
End If
Rumus Perulangan
For s = 1 To 24
cmblama.AddItem s
Next
Perulangan kelipatan 5
For b = 0 To 50 Step 5
cmbbunga.AddItem b
Next
Rumus Login
With dtlogin.Recordset
.Index = "xkode"
.Seek "=", dbuser.Text
If Not .NoMatch Then
If txtpas.Text = !pas Then
menu.Show
Unload Me
Else
MsgBox "Username atau Password Salah", vbCritical, "L O
G I N"
dbuser.Text = ""
txtpas.Text = ""
dbuser.SetFocus
End If
End If
End With
Untuk Proses dengan ENTER
If KeyAscii = 13 Then
If Val(txtbyar.Text) < Val(txttotal.Text) Then
a = MsgBox("Uang Anda Kurang", vbCritical + vbOKCancel,
"Dilarang Hutang")
If a = vbOK Then
txtbyar.Text = ""
txtbyar.SetFocus
Else
txtkmbali.Text = Val(txtbyar.Text) - Val(txttotal.Text)
txtkmbali.Enabled = False
End If
Else
txtkmbali.Text = Val(txtbyar.Text) - Val(txttotal.Text)
txtkmbali.Enabled = True
End If
End If

0 komentar:
Posting Komentar