Desaign Form
Atur Properties
Name : DataBarang
Databasename : <
Recordset Type : 0 - Table
RecordSource : Barang
Visible : False
Listing Program
Sub siapisi()
'objek berfungsi untuk siap isi
Me.txtkode.Enabled = True
Me.txtnama.Enabled = True
Me.csatuan.Enabled = True
Me.txtharga.Enabled = True
Me.txtstock.Enabled = True
End Sub
Sub tdksiapisi()Me.txtkode.Enabled = False
Me.txtnama.Enabled = False
Me.csatuan.Enabled = False
Me.txtharga.Enabled = False
Me.txtstock.Enabled = False
End Sub
Sub bersih()Me.txtkode.Text = ""
Me.txtnama.Text = ""
Me.csatuan.Text = "Silahkan Pilih"
Me.txtharga.Text = ""
Me.txtstock.Text = ""
End Sub
Private Sub cmdbatal_Click()tdksiapisi
bersih
Me.cmdbatal.Enabled = False
Me.cmdkeluar.Enabled = True
Me.cmdtambah.Enabled = True
Me.cmdsimpan.Enabled = False
End Sub
Private Sub cmdbrowse_Click()Frmbrowse.Show
Frminputdata.Hide
End Sub
Private Sub cmdkeluar_Click()Unload Me
End Sub
Private Sub cmdsimpan_Click()'Menyimpan Data dalam database
Me.DataBarang.Recordset.AddNew
Me.DataBarang.Recordset!kodebrg = Me.txtkode.Text
Me.DataBarang.Recordset!namabrg = Me.txtnama.Text
Me.DataBarang.Recordset!satuan = Me.csatuan.Text
Me.DataBarang.Recordset!harga = Me.txtharga.Text
Me.DataBarang.Recordset!stock = Me.txtstock.Text
Me.DataBarang.Recordset.Update
'Mengaktifkan Tombol
Me.cmdbatal.Enabled = False
Me.cmdsimpan.Enabled = False
Me.cmdkeluar.Enabled = True
Me.cmdtambah.Enabled = True
'memanggil Prosedur
tdksiapisi
bersih
End Sub
Private Sub cmdtambah_Click()
'Membuat Data Baru
Me.DataBarang.Recordset.AddNew
siapisi
bersih
Me.txtkode.SetFocus
'Mengaktifkan Tombol
Me.cmdbatal.Enabled = True
Me.cmdsimpan.Enabled = True
Me.cmdkeluar.Enabled = False
Me.cmdtambah.Enabled = False
End Sub
Private Sub csatuan_Click()Me.txtharga.SetFocus
End Sub
Private Sub Form_Activate()tdksiapisi
bersih
Me.cmdbatal.Enabled = False
Me.cmdsimpan.Enabled = False
End Sub
Private Sub Form_Load()Me.csatuan.AddItem "Pack"
Me.csatuan.AddItem "Lusin"
Me.csatuan.AddItem "Rim"
End Sub
Private Sub txtharga_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
Me.txtstock.SetFocus
End If
End Sub
Private Sub txtkode_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
Me.txtnama.SetFocus
End If
End Sub
Private Sub txtnama_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
Me.csatuan.SetFocus
End If
End Sub
DOWNLOAD VERSI WORD
0 komentar:
Posting Komentar