Академический Документы
Профессиональный Документы
Культура Документы
Sruktur Database
Database : penjualan.mdb
Tabel:
1. Barang
Name
Type
Size
Keteranga
KdBaran
Text
10
Primary
g
Key
NmBaran
Text
20
g
Satuan
Text
10
Harga
Curren
cy
Stok
Numbe
r
2. Customer
Name
IdCust
NmCust
Alamat
Telp
3. Transaksi
Name
NoTrans
TglJual
Total
IdCust
4. Detail
Name
NoTrans
Qty
SubTotal
KdBaran
g
5. Sementara
Name
KdBaran
Type
Text
Size
10
Text
Text
Text
20
30
15
Type
Text
Size
10
Date/Ti
me
Currenc
y
Text
10
Type
Text
Number
Currenc
y
Text
Size
10
Type
Text
Size
10
Keteranga
Primary
Key
Keteranga
Primary
Key
Keteranga
10
Keteranga
g
NmBaran
g
Harga
Qty
Subtotal
Text
20
Currenc
y
Number
Currenc
y
DataCombo
DataCombo
DataGrid
Objec
Adodc1
Adodc2
Adodc3
Adodc4
Adodc5
DataCombo1
DataCombo2
DataGrid1
Properties
Name
ConnectionString
RecordSource
Name
ConnectionString
RecordSource
Name
ConnectionString
RecordSource
Name
ConnectionString
RecordSource
Name
ConnectionString
RecordSource
Name
DataSource
RowSource
ListField
Name
DataSource
RowSource
ListField
Name
DataSource
Value
AdoBrg
Penjualan
Barang
AdoCus
Penjualan
Customer
AdoTrans
Penjualan
Transaksi
AdoDet
Penjualan
Detail
AdoSem
Penjualan
Sementara
cbcus
AdoCus
AdoCus
IdCust
cbcbrg
AdoBrg
AdoBrg
KdBarang
DataGrid1
AdoSem
Coding:
Buatlah sub bersih,mati dan hidup di Modul
Private Sub Form_Load()
bersih Me
mati Me
bInput.Enabled = True
bSave.Enabled = False
bCancel.Enabled = False
bExit.Enabled = True
End Sub
Sub nomor()
Dim no As Integer
AdoTrans.Refresh
With AdoTrans.Recordset
If .RecordCount <= 0 Then
bCancel.Enabled = True
bInput.Enabled = False
End Sub
Private Sub cbcus_Click(Area As
Integer)
AdoCus.Refresh
With AdoCus.Recordset
.Find "IdCus='" & cbcus.Text & "'"
If Not .EOF Then
txtnc.Text = !NmCus
txtalamat.Text = !Alamat
txttlp.Text = !Telp
End If
End With
cbbrg.Enabled = True
End Sub
Private Sub cbbrg_Change()
AdoBrg.Refresh
With AdoBrg.Recordset
.Find "KdBarang='" & cbbrg.Text &
"'"
If Not .EOF Then
txtnb.Text = !NmBarang
txtharga.Text = !Harga
End If
txtjb.Enabled = True
txtjb.SetFocus
End With
End Sub
Private Sub
txtjb_KeyPress(KeyAscii As
Integer)
If KeyAscii = 13 Then
'cek stok
AdoBrg.Refresh
AdoBrg.Recordset.Find "KdBarang='" &
cbbrg.Text & "'"
If Val(txtjb.Text) > AdoBrg.Recordset!
Stok Then
End If
End Sub
Private Sub txtubay_Change()
txtukem.Text = Val(txtubay.Text) Val(txttobay.Text)
End Sub
Private Sub bSave_Click()
'simpan ke tabel transaksi
AdoTrans.Refresh
AdoTrans.Recordset.AddNew
AdoTrans.Recordset!NoTrans =
txtno.Text
AdoTrans.Recordset!TglJual =
txttgl.Text
AdoTrans.Recordset!Total =
txttobay.Text
AdoTrans.Recordset!IdCus =
cbcus.Text
AdoTrans.Recordset.Update
'simpan ke tabel detail
AdoSem.Refresh
AdoSem.Recordset.MoveFirst
While Not AdoSem.Recordset.EOF
AdoDet.Refresh
With AdoDet.Recordset
.AddNew
!NoTrans = txtno.Text
!Qty = AdoSem.Recordset!Qty
!SubTotal = AdoSem.Recordset!
SubTotal
!KdBarang = AdoSem.Recordset!
KdBarang
.Update
End With
'menghapus record tabel
sementara per baris
AdoSem.Recordset.Delete
AdoSem.Recordset.MoveNext
Wend
Form_Load
End Sub
Private Sub bCancel_Click()
Form_Load
End Sub
Private Sub bExit_Click()
a = MsgBox("Are You Sure Want to
Exit?", vbQuestion + vbYesNo,
"Confirm")
If a = vbYes Then
Unload Me
End If
End Sub