Tugas data base

vb data base

Private Sub Command1_Click()
Dim snpm As String
snpm = InputBox(“npm:*”)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find “npm =” & snpm & “”
End Sub

Private Sub Command2_Click()
Txtnama.SetFocus
Adodc1.Recordset.AddNew

End Sub

Private Sub Command3_Click()
Adodc1.Recordset.Update
MsgBox “data berhasil disimpan…!!!”, vbOKOnly + vbInformation, “konfirmasi”
End Sub

Private Sub Command4_Click()
If MsgBox(“apakah anda yakin ingin menghapusnya…???”, vbOKCancel + vbCritical, “konfirmasi”) = vbOK Then
Adodc1.Recordset.Delete
End If
End Sub

Private Sub Command5_Click()
End
End Sub

Private Sub Form_Activate()
Txtnama.SetFocus
Txtnama.Text = “”
txtnpm.Text = “”
txtjr.Text = “”
txtnurut.Text = “”
txtps.Text = “”
txttm.Text = “”
End Sub

TUGAS VB 9

TUGAS 9

Private Sub cmdBATAL_Click()
TXTNK.SetFocus
TXTGOL.Text = “”
TXTKS.Text = “”
TXTS.Text = “”
TXTTH.Text = “”
TXTJB.Text = “”
TXTBG.Text = “”
TXTGPOK.Text = “”
TXTTNJ.Text = “”
TXTTTAL.Text = “”
TXTNK.Text = “”
TXTNIK.Text = “”
End Sub
Private Sub cmdKELUAR_Click()
End
End Sub
Private Sub cmdLAGI_Click()
TXTNK.SetFocus
TXTGOL.Text = “”
TXTKS.Text = “”
TXTS.Text = “”
TXTTH.Text = “”
TXTJB.Text = “”
TXTBG.Text = “”
TXTGPOK.Text = “”
TXTTNJ.Text = “”
TXTTTAL.Text = “”
TXTNK.Text = “”
TXTNIK.Text = “”
End Sub
Private Sub cmdPROSES_Click()
Dim gl, ks, s As String
Dim th, jb, bg As Variant
Dim gp, tnj, ttal As Long
TXTTH.Text = Left(TXTNIK.Text, 4)
a = Mid(TXTNIK.Text, 5, 1)
If a = “A” Then
gl = “A”
jb = “Manager”
gp = “4000000”
tnj = “1025000”
ElseIf a = “B” Then
gl = “B”
jb = “Ka. Seksi”
gp = “3500000”
tnj = “975000”
ElseIf a = “C” Then
gl = “C”
jb = “Staff”
gp = “3000000”
tnj = “950000”
End If
TXTGOL.Text = gl
TXTJB.Text = jb
TXTGPOK.Text = gp
TXTTNJ.Text = tnj
a = Right(TXTNIK.Text, 3)
If a = “KEU” Then
bg = “Accounting”
ElseIf a = “ADM” Then
bg = “Administrasi”
ElseIf a = “SDM” Then
bg = “General Affair”
ElseIf a = “EDP” Then
bg = “IT Unit”
ElseIf a = “SDP” Then
bg = “Security”
End If
TXTBG.Text = bg
a = Mid(TXTNIK.Text, 7, 1)
If a = “S” Then
ks = “S”
s = “Single”
ElseIf a = “M” Then
ks = “M”
s = “Menikah”
ElseIf a = “J” Then
ks = “J”
s = “Janda”
ElseIf a = “D” Then
ks = “D”
s = “Duda”
End If
TXTKS.Text = ks
TXTS.Text = s
TXTTTAL.Text = Val(TXTGPOK.Text) + Val(TXTTNJ.Text)
End Sub
Private Sub txtNK_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTNIK.SetFocus
End If
End Sub

TUGAS VB 8

TUGAS 8

Private Sub cmdbatal_Click()
CBO.SetFocus
CBO.Text = “”
TXTA.Text = “”
TXTB.Text = “”
TXTC.Text = “”
TXTD.Text = “”
TXTE.Text = “”
End Sub
Private Sub cmdkeluar_Click()
End
End Sub
Private Sub cmdlagi_Click()
CBO.SetFocus
CBO.Text = “”
TXTA.Text = “”
TXTB.Text = “”
TXTC.Text = “”
TXTD.Text = “”
TXTE.Text = “”
End Sub
Private Sub cmdproses_Click()
Dim jb, pg, tt As String
Dim pt, hg As Variant
TXTC.Text = “20” & Mid(CBO.Text, 5, 2)
a = Left(CBO.Text, 3)
If a = “sim” Then
jb = “sistem informasi management”
pg = “fadiya ulfa”
hg = “75900”
ElseIf a = “edp” Then
jb = “elektronic data processing”
pg = “nurul agustina”
hg = “62000”
ElseIf a = “mnj” Then
jb = “manajemen”
pg = “rian hidayat”
hg = “42000”
ElseIf a = “cdr” Then
jb = “coreldraw”
pg = “siti nur khotimah”
hg = “53000”
ElseIf a = “rpl” Then
jb = “rekayasa perangkat lunak”
pg = “winda erlianti”
hg = “83000”
End If
TXTA.Text = jb
TXTB.Text = pg
TXTE.Text = hg
a = Right(CBO.Text, 1)
If a = “a” Then
pt = “andi offset yogyakarta”
ElseIf a = “i” Then
pt = “indah surabaya”
ElseIf a = “s” Then
pt = “selemba empat”
ElseIf a = “e” Then
pt = “elek media komputindo”
ElseIf a = “m” Then
pt = “maxicom”
End If
TXTD.Text = pt
End Sub
Private Sub Form_Load()
CBO.AddItem “sim-09-a”
CBO.AddItem “edp-10-i”
CBO.AddItem “mnj-11-s”
CBO.AddItem “cdr-12-e”
CBO.AddItem “rpl-13-m”
End Sub

TUGAS VB 7

TUGAS 7

Private Sub cmdbatal_Click()
CBO.SetFocus
CBO.Text = “”
TXT1.Text = “”
TXT2.Text = “”
TXT3.Text = “”
TXT4.Text = “”
TXT5.Text = “”
End Sub
Private Sub cmdkeluar_Click()
End
End Sub
Private Sub cmdlagi_Click()
CBO.SetFocus
CBO.Text = “”
TXT1.Text = “”
TXT2.Text = “”
TXT3.Text = “”
TXT4.Text = “”
TXT5.Text = “”
End Sub
Private Sub cmdproses_Click()
Dim jb, pg, tt As String
Dim pt, hg As Variant
TXT3.Text = “20” & Right(CBO.Text, 2)
a = Mid(CBO.Text, 3, 3)
If a = “sim” Then
jb = “sistem informasi management”
pg = “yati nur oktavia”
hg = “75900”
ElseIf a = “edp” Then
jb = “elektronic data processing”
pg = “imam tarmizi”
hg = “62000”
ElseIf a = “mnj” Then
jb = “manajemen”
pg = “valentina mariana adiwianti”
hg = “42000”
ElseIf a = “cdr” Then
jb = “coreldraw”
pg = “riyan suhandi”
hg = “53000”
ElseIf a = “rpl” Then
jb = “rekayasa perangkat lunak”
pg = “sinta umpu singa”
hg = “83000”
End If
TXT1.Text = jb
TXT2.Text = pg
TXT5.Text = hg
a = Left(CBO.Text, 1)
If a = “a” Then
pt = “andi offset yogyakarta”
ElseIf a = “i” Then
pt = “indah surabaya”
ElseIf a = “s” Then
pt = “selemba empat”
ElseIf a = “e” Then
pt = “elek media komputindo”
ElseIf a = “m” Then
pt = “maxicom”
End If
TXT4.Text = pt
End Sub

Private Sub Form_Load()
CBO.AddItem “a-sim-01”
CBO.AddItem “i-edp-02”
CBO.AddItem “s-mnj-03”
CBO.AddItem “e-cdr-04”
CBO.AddItem “m-rpl-05”
End Sub

TUGAS VB 6

TUGAS 6

Private Sub CMDBATAL_Click()
TXTNAMA.SetFocus
TXTNAMA.Text = “”
TXTNPM.Text = “”
TXTJURUSAN.Text = “”
TXTPS.Text = “”
TXTNU.Text = “”
TXTTM.Text = “”
End Sub

Private Sub CMDKELUAR_Click()
End
End Sub

Private Sub CMDLAGI_Click()
TXTNAMA.SetFocus
TXTNAMA.Text = “”
TXTNPM.Text = “”
TXTJURUSAN.Text = “”
TXTPS.Text = “”
TXTNU.Text = “”
TXTTM.Text = “”
End Sub

Private Sub CMDPROSES_Click()
Dim JURUSAN, PS As String
TXTTM.Text = “20” & Left(TXTNPM.Text, 2)
A = Mid(TXTNPM.Text, 3, 1)
If A = “1” Then
JURUSAN = “SISTEM INFORMASI”
ElseIf A = “2” Then
JURUSAN = “MENEJEMEN INFORMATIKA”
ElseIf A = “3” Then
JURUSAN = “TEHNIK INFORMATIKA”
ElseIf A = “4” Then
JURUSAN = “KOMPUTER AKUTANSI”
End If
TXTJURUSAN.Text = JURUSAN
A = Mid(TXTNPM.Text, 4, 2)
If A = “01” Then
PS = “STRATA SATU”
ElseIf A = “02” Then
PS = “DIPLOMA EMPAT”
ElseIf A = “03” Then
PS = “DIPLOMA TIGA”
ElseIf A = “04” Then
PS = “DIPLOMA DUA”
End If
TXTPS.Text = PS
TXTNU.Text = Right(TXTNPM.Text, 3)

End Sub
Private Sub TXTNAMA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTNPM.SetFocus
End If
End Sub

TUGAS VB 5

TUGAS 5

Private Sub CBOGOL_Click()
Dim GP, PAJAK, TUN, TOTAL As Variant
Select Case CBOGOL.Text
Case “I”
GP = 15000000
TUN = 150000
Case “II”
GP = 2000000
TUN = 200000
Case “III”
GP = 2500000
TUN = 250000
Case “IV”
GP = 3000000
TUN = 300000
End Select
TOTAL = GP + TUN
PAJAK = TOTAL * 0.1

TXTGP.Text = GP
TXTTUN.Text = TUN
TXTPAJAK.Text = PAJAK
TXTTOTAL.Text = TOTAL – PAJAK
End Sub

Private Sub CMDBATAL_Click()
TXTNIDN.SetFocus
TXTNIDN.Text = “”
TXTNP.Text = “”
CBOGOL.Text = “”
TXTGP.Text = “”
TXTTUN.Text = “”
TXTPAJAK.Text = “”
TXTTOTAL.Text = “”
End Sub

Private Sub CMDKELUAR_Click()
End
End Sub

Private Sub CMDLAGI_Click()
TXTNIDN.SetFocus
TXTNIDN.Text = “”
TXTNP.Text = “”
CBOGOL.Text = “”
TXTGP.Text = “”
TXTTUN.Text = “”
TXTPAJAK.Text = “”
TXTTOTAL.Text = “”
End Sub

Private Sub Form_Load()
CBOGOL.AddItem “I”
CBOGOL.AddItem “II”
CBOGOL.AddItem “III”
CBOGOL.AddItem “IV”
End Sub

Private Sub TXTNIDN_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTNP.SetFocus
End If
End Sub

TUGAS VB 4

TUGAS 4

Private Sub Check1_Click()
If Check1.Value = 1 Then
Label1.FontBold = True
Else: Label1.FontBold = False
End If
End Sub

Private Sub Check2_Click()
If Check2.Value = 1 Then
Label1.FontItalic = True
Else: Label1.FontItalic = False
End If
End Sub

Private Sub Check3_Click()
If Check3.Value = 1 Then
Label1.FontUnderline = True
Else: Label1.FontUnderline = False
End If
End Sub

Private Sub Check4_Click()
If Check4.Value = 1 Then
Label1.FontStrikethru = True
Else: Label1.FontStrikethru = False
End If
End Sub

Private Sub Command1_Click()
End
End Sub

Private Sub Option1_Click()
Label1.ForeColor = vbRed
End Sub

Private Sub Option2_Click()
Label1.ForeColor = vbGreen
End Sub

Private Sub Option3_Click()
Label1.ForeColor = vbBlue
End Sub

Private Sub Option4_Click()
Label1.ForeColor = vbYellow

End Sub