Koneksi VB dengan Access

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

VB Data Diri Mahasiswa

 

Code VB Data Diri Mahasiswa :

Private Sub Command1_Click()
Dim S As String
Text5.Text = “20” & Left(Text2.Text, 2)
S = Mid(Text2.Text, 3, 1)
If S = “1” Then
Text3.Text = “Sistem Informasi”
ElseIf S = “2” Then
Text3.Text = “Manajemen Informatika”
ElseIf S = “3” Then
Text3.Text = “Tehnik Informatika”
ElseIf S = “4” Then
Text3.Text = “Manajemen & Komp. Akuntansi”
End If
S = Mid(Text2.Text, 4, 2)
If S = “00” Then
Text4.Text = “Strata Satu”
ElseIf S = “01” Then
Text4.Text = “Strata Satu”
ElseIf S = “02” Then
Text4.Text = “Diploma Tiga”
ElseIf S = “03” Then
Text4.Text = “Diploma Empat”
ElseIf S = “04” Then
Text4.Text = “Diploma Dua”
End If
Text6.Text = Right(Text2.Text, 3)
End Sub

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

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

Private Sub Command4_Click()
End
End Sub

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

VB Huruf Mutu Mahasiswa STMIK Pringsewu

 

Code VB Huruf Mutu Mahasiswa STMIK Pringsewu :

Private Sub Combo1_Click()
Dim nama, jurusan, NM As String
Select Case Combo1.Text
Case “12100654”
nama = “Rivandi Saputra”
jurusan = “Sistem Informasi”
Case “12100655”
nama = “Revita Yulistina”
jurusan = “Sistem Informasi”
Case “12100409”
nama = “Windri Puji Astuti”
jurusan = “Sistem Informasi”
Case “12100410”
nama = “Dwi Indah”
jurusan = “Sistem Informasi”
Case “12100414”
nama = “Suntiaji Yudo Negoro”
jurusan = “Sistem Informasi”
Case “12201111”
nama = “Fajar Deswantoro”
jurusan = “Manajemen Informatika”
Case “12100413”
nama = “Herianto”
jurusan = “Sistem Informasi”
End Select
Text1.Text = nama
Text2.Text = jurusan
Text3.SetFocus
End Sub

Private Sub Command1_Click()
Dim na As Integer
Dim hm As String
quis = Val(Text3.Text)
TUGAS = Val(Text4.Text)
uts = Val(Text5.Text)
uas = Val(Text6.Text)
na = (quis + TUGAS + uts + uas) / 4
Text7.Text = na
Select Case Text7.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
Text8.Text = hm
End Sub

Private Sub Command2_Click()
Combo1.SetFocus
Combo1.Text = “”
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
Text7.Text = “”
Text8.Text = “”
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Form_Load()
Combo1.AddItem “12100654”
Combo1.AddItem “12100655”
Combo1.AddItem “12100409”
Combo1.AddItem “12100410”
Combo1.AddItem “12100414”
Combo1.AddItem “12100413”
Combo1.AddItem “12201111”
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub

VB Data Buku Perpustakaan Milik Bersama

 

Code VB Data Buku Perpustakaan Milik Bersama :

Private Sub Command1_Click()
Dim jb, pg, tt As String
Dim pt, hg As Variant
Text3.Text = “20” & Mid(Combo1.Text, 5, 2)
a = Left(Combo1.Text, 3)
If a = “WEB” Then
jb = “Ebook Web Design”
pg = “Rivandi Saputra”
hg = “125000”
ElseIf a = “SIM” Then
jb = “Sistem Informasi Management”
pg = “Revita Yulistina”
hg = “75900”
ElseIf a = “EDP” Then
jb = “Elektronic Data Processing”
pg = “Bambang Deswantoro”
hg = “62000”
ElseIf a = “MNJ” Then
jb = “Manajemen”
pg = “Agus Fahrudi”
hg = “42000”
ElseIf a = “ITC” Then
jb = “Information Tecnologi”
pg = “Rivandi Saputra”
hg = “53000”
ElseIf a = “JPL” Then
jb = “Jaringan Perangkat Lunak”
pg = “Widianti”
hg = “83000”
End If
Text1.Text = jb
Text2.Text = pg
Text5.Text = hg
a = Right(Combo1.Text, 1)
If a = “1” Then
pt = “ICS Ivan Cyber System Tec”
ElseIf a = “2” Then
pt = “Saifull Jakarta”
ElseIf a = “3” Then
pt = “Jaya Bakti”
ElseIf a = “4” Then
pt = “Lembah Hijau”
ElseIf a = “5” Then
pt = “Rivandi Saputra Tec”
ElseIf a = “6” Then
pt = “Sinar Jaya”
End If
Text4.Text = pt
End Sub

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

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

Private Sub Command4_Click()
End
End Sub

Private Sub Form_Load()
Combo1.AddItem “WEB-13-1”
Combo1.AddItem “SIM-08-2”
Combo1.AddItem “EDP-09-3”
Combo1.AddItem “MNJ-10-4”
Combo1.AddItem “ITC-11-5”
Combo1.AddItem “JPL-12-6”
End Sub

VB Gaji Pokok Tunjangan

 

Code VB Gaji Pokok Tunjangan :

Private Sub Combo1_Click()
Dim gapok, pajak, tunjangan, total As Variant
Select Case Combo1.Text
Case “I”
gapok = 1500000
tunjangan = 150000
Case “II”
gapok = 2000000
tunjangan = 200000
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 Command1_Click()
kosong
End Sub

Private Sub Command2_Click()
kosong
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

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

Public Sub kosong()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
Combo1.Text = “”
End Sub

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

VB Aplikasi Penghitungan Gaji

 

Code VB Aplikasi Penghitungan Gaji :

Private Sub Command1_Click()
Dim A, B, C, D, E, F As Double
Text4.Text = Val(Text1.Text) + Val(Text2.Text) – Val(Text3.Text)
Text5.Text = Val(Text4.Text) * (0.1)
Text6.Text = Val(Text4.Text) – Val(Text5.Text)
End Sub

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

Private Sub Command3_Click()
End
End Sub

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

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub

VB Font Color dan Font Style

 

Code VB Font Color dan Font Style :

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 Check1.Value = 1 Then
Label1.FontItalic = True
Else
Label1.FontItalic = False
End If
End Sub

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

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

Private Sub Command1_Click()
End
End Sub

Private Sub Label1_Click()

End Sub

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