Tugas VB : Koneksi VB dengan Access

Untitled

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()
Text1.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 Sub

Private Sub Command5_Click()
End
End Sub

Private Sub Form_Activate()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub

tugas VB : No. 9

 

quis 3
Private Sub cmdBTL_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 cmdKL_Click()
End
End Sub

Private Sub cmdLG_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 cmdPRS_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 : No. 8

quis2

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 : No. 7

quis 1

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” & 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
txta.Text = jb
txtb.Text = pg
txte.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
txtd.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 : No. 6

test visual

Private Sub Check1_Click()
Label2.FontBold = Check1.Value
End Sub

Private Sub Check2_Click()
Label2.FontItalic = Check2.Value
End Sub

Private Sub Command1_Click()
Label2.Caption = Text1.Text
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Option1_Click()
Label2.ForeColor = vbBlue
End Sub

Private Sub Option2_Click()
Label2.ForeColor = vbRed
End Sub

tugas VB : No.5

nilai huruf

Private Sub cbo_Click()
Dim nama, jurusan, NM As String
Select Case cbo.Text
Case “12100414”
nama = “Suntiaji Yudo Negoro”
jurusan = “Sistem Iformasi”
Case “12201111”
nama = “Fajar Deswantoro”
jurusan = “manajemen informatika”
Case “12100413”
nama = “herianto”
jurusan = “sistem informasi”
End Select
txta.Text = nama
txtb.Text = jurusan
txtc.SetFocus
End Sub

Private Sub cmdB_Click()
cbo.SetFocus
txta = “”
txtb = “”
txtc = “”
txtd = “”
txte = “”
txtf = “”
txtg = “”
txth = “”
End Sub

Private Sub cmdK_Click()
End
End Sub

Private Sub cmdP_Click()
Dim na As Integer
Dim hm As String
quis = Val(txtc.Text)
TUGAS = Val(txtd.Text)
uts = Val(txte.Text)
uas = Val(txtf.Text)
na = (quis + TUGAS + uts + uas) / 4
txtg.Text = na
Select Case txtg.Text
Case Is > 80
hm = “A”
Case Is > 70
hm = “B”
Case Is > 60
hm = “C”
Case Is > 50
hm = “D”
Case Is < 50
hm = “E”
End Select
txth.Text = hm
End Sub

Private Sub Form_Load()
cbo.AddItem “12100414”
cbo.AddItem “12100413”
cbo.AddItem “12201111”
End Sub

Private Sub txtc_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtd.SetFocus
End If
End Sub

Private Sub txtd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txte.SetFocus
End If

End Sub

Private Sub txte_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtf.SetFocus
End If

End Sub

tugas VB : No. 4

nidn

Private Sub Cbo_Click()
Dim gapok, pajak, tunjangan, total As Variant
Select Case Cbo.Text
Case “I”
gapok = 1500000
tunjangan = 150000
Case “II”
gapok = 2000000
tunjangan = 20000
Case “III”
gapok = 2500000
tunjangan = 250000
Case “IV”
gapok = 3000000
tunjangan = 300000
Case Else
gapok = 0
tunjangan = 0
End Select
total = gapok + tunjangan
pajak = total * 0.1
Text3.Text = gapok
Text4.Text = tunjangan
Text5.Text = pajak
Text6.Text = total – pajak
End Sub

Private Sub cmdBTL_Click()
kosong
End Sub

Private Sub cmdKL_Click()
End
End Sub

Private Sub cmdLG_Click()
kosong
End Sub

Private Sub Form_Load()
Cbo.AddItem “I”
Cbo.AddItem “II”
Cbo.AddItem “III”
Cbo.AddItem “IV”
End Sub
Public Sub kosong()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub