----------Posting Terbaru--------------

Minggu, 19 Februari 2012

Home » » visual basic input data barang

visual basic input data barang

Pertama yang kita lakukan adalah membuat form dan databasenya sebagai berikut:
gambar1.1
form1

1. Database
*. Kode barang
*. Nama Barang
*. Satuan
*. Harga
setelah anda Membuat databasenya maka anda harus membuat form setelah jadi form dan yang telah di desain menurut ke inginan anda sendiri maka yang terkahir adalah membuat kode program sebagai berikut:
KODE PROGRAM
Private Sub Command1_Click()
Data1.Recordset.MoveFirst
If Data1.Recordset.BOF Then
Data1.Recordset.MoveNext
End If
End Sub
Private Sub Command10_Click()
Data1.Recordset.FindFirst “kode= ‘” + Text1 + “‘”
If Data1.Recordset.NoMatch Then
MsgBox “kode tidak di temukan”, vbQuestion, “cari data”
Text1.SetFocus
Data1.Recordset.MoveFirst
End If
Command5.Enabled = True
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = True
Command9.Enabled = True
Command10.Enabled = True
End Sub
Private Sub Command11_Click()
End
End Sub
Private Sub Command2_Click()
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
End If
End Sub
Private Sub Command3_Click()
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
End If
End Sub
Private Sub Command4_Click()
Data1.Recordset.MoveLast
If Data1.Recordset.EOF Then
Data1.Recordset.MovePrevious
End If
End Sub

Private Sub Command5_Click()
Data1.Recordset.AddNew
Call aktif
Text1.SetFocus
Command5.Enabled = False
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = True
End Sub
Private Sub aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
End Sub
Private Sub takaktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
End Sub
Private Sub kosong()
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
End Sub
Private Sub Command6_Click()
Data1.Recordset.Update
Data1.Recordset.MoveFirst
Call takaktif
Command5.Enabled = True
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = True
Command9.Enabled = True
Command10.Enabled = True
End Sub
Private Sub Command7_Click()
Data1.Recordset.Edit
Data1.Recordset.CancelUpdate
Call takaktif
Command5.Enabled = True
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = True
Command9.Enabled = True
Command10.Enabled = True
End Sub
Private Sub Command8_Click()
Data1.Recordset.Edit
Call aktif
Text1.SetFocus
Command5.Enabled = False
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = True
End Sub
Private Sub Command9_Click()
hapus = MsgBox(“hapus data?”, vbInformation + vbYesNo, “hapus data”)
If hapus = vbYes Then
Data1.Recordset.Delete
Data1.Recordset.MoveNext
Else
Data1.Recordset.MoveFirst
End If
End Sub
Private Sub Form_Load()
kosong
Call takaktif
Command5.Enabled = True
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = True
Command9.Enabled = True
Command10.Enabled = True
End Sub
hasil:
gambar1.2
hasil dari program input barang

Share this article :

Poskan Komentar

 
Copyright © 2011. Pelajaran: visual basic input data barang . All Rights Reserved
Company Info | Contact Us | Privacy policy | Term of use | Widget | Advertise with Us | Site map
Template modify by Creating Website. Inspired from CBS News