Minggu, 18 Desember 2011

TUGAS KELOMPOK VB


MEMBUAT DATA BASE MENGGUNAKAN VISUAL BASIC
1.Membuat 3 form dlm 3 tabel,masing-masing tabel 1 form
2.masing-masing form diberi report
3.dibuat menu utama
4.listing dan tampilan print screen dalam word



TABEL1
(Tabel Barang)




Listing:
Sub aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Combo1.Enabled = True

End Sub
Sub tidak()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Combo1.Enabled = False
End Sub

Private Sub Command1_Click()
Data1.Recordset.AddNew
Data1.Recordset!kd_brg = Text1.Text
Data1.Recordset!nm_brg = Text2.Text
Data1.Recordset!satuan = Combo1.Text
Data1.Recordset!harga = Text3.Text
Data1.Recordset.Update
tidak
Command1.Enabled = True
End Sub

Private Sub Command2_Click()
aktif
Data1.Recordset.AddNew
Text1.SetFocus
End Sub
Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Command4_Click()
DataReport1.Show
End Sub
Private Sub Command5_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Combo1.Text = ""
End Sub
Private Sub Form_Activate()
tidak
Command2.SetFocus
End Sub
Private Sub Command6_Click()
Form4.Show
Form1.Hide
End Sub



Membuat  report table barang

















2. Membuat table pelanggan





Listing:
Sub nonaktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
End Sub
Sub aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
End Sub
Private Sub Command1_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
aktif
Data1.Recordset.AddNew
Command1.Enabled = False
Command2.Enabled = True
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Data1.Recordset.AddNew
Data1.Recordset!kd_plg = Text1.Text


Data1.Recordset!nm_plg = Text2.Text
Data1.Recordset!almat = Text3.Text
Data1.Recordset!no_tlp = Text4.Text
Data1.Recordset.Update
nonaktif
End Sub
Private Sub Command3_Click()
a = MsgBox("keluar", vbQuestion + vbYesNo, "info")
If a = vbYes Then
End If
End
End Sub
Private Sub Command4_Click()
DataReport2.Show
End Sub
Private Sub Command5_Click()
Form4.Show
Form2.Hide
End Sub










Membuat report tabel2











3.tabel transaksi



Listing:
Sub tombolsemula()
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
Command4.Caption = False
End Sub
Sub bersih()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""

Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Combo1 = ""
Combo2 = ""
End Sub
Sub aktif()
Text1.Enabled = True
Combo1.Enabled = True
Combo2.Enabled = True
Text6.Enabled = True
Text8.Enabled = True
End Sub
Sub nonaktif()
Text1 = False
Text2 = False
Text3 = False
Text6 = False
Text7 = False
Text8 = False
Text9 = False
Text10 = False
Combo1.Enabled = False
Combo2.Enabled = False
End Sub
Sub output()
Text3.Enabled = False
Text2.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
End Sub
Private Sub Combo1_Click()
If Combo1.Text = "k001" Then
Text2.Text = "nia"
ElseIf Combo1.Text = "k002" Then
Text2.Text = "tiara"
Else
Text2.Text = "arum"
End If
End Sub
Private Sub Combo2_Click()
If Combo2.Text = "A001" Then
Text4.Text = "siomay komplit"
Text5.Text = 7000
ElseIf Combo2.Text = "A002" Then
Text4.Text = "batagor"
Text5.Text = 8000
Else
Text4.Text = "dimsum"
Text5.Text = 15000
End If
End Sub
Private Sub Command1_Click()
bersih
aktif
Text1.SetFocus
Command2.Enabled = True
Command3.Caption = "Batal"
End Sub
Private Sub Command2_Click()
With Data1.Recordset
.AddNew
!no_nota = Text1.Text
!nm_pelanggan = Combo1.Text
!nm_barang = Text4.Text
!harga = Text5.Text
!jumlah = Text6.Text
!total = Text7.Text
!bayar = Text8.Text
!kembali = Text9.Text
.Update
End With
bersih
nonaktif
tombolsemula

End Sub

Private Sub Command3_Click()
x = MsgBox("Benar ingin keluar?", vbOKCancel + vbQuestion, "Konfirmasi")
If x = vbOK Then
'MDIForm1.Show
'FormTransaksi.Hide
End If
End
End Sub
Private Sub Text6_Change()
Text7.Text = Val(Text5.Text) * Val(Text6.Text)
End Sub
Private Sub Text8_Change()
Text9.Text = Val(Text8.Text) - Val(Text7.Text)
End SubPrivate Sub Timer1_Timer()
Text3 = Date
End Sub
Private Sub Command5_Click()
Form4.Show
Form3.Hide
End Sub











Membuat report transaksi


Membuat Menu Utama
1.Buat form baru
2.Klik menu editor
3.Maka akan muncul jendela;
4.Isi caption, name, shortcut kemudian bila sudah terisi seprti gambar diatas kli ok
5.Maka tampilanya seperti di bawah ini;




6.klik barang,maka akan tampil kotak listing
 Isikan;

Private Sub mnbarang_Click()
Form1.Show
Form4.Hide
End Sub

Private Sub mnpelanggan_Click()
Form2.Show
Form4.Hide
End Sub

Private Sub tttransaksi_Click()
Form3.Show
Form4.Hide
End Sub

Private Sub eeexit_Click()
End
End Sub