Komponen Yang Digunakan :
- Microsoft Ado Data Control 6.0 (OLEDB)
- Microsoft DataGrid Control 6.0 (OLEDB)
Listing Modul :
Public conn As New ADODB.Connection
Public rskue As New ADODB.Recordset
Public rstransaksi As New ADODB.Recordset
Public Sub koneksi()
Set conn = New ADODB.Connection
Set rskue = New ADODB.Recordset
Set rstransaksi = New ADODB.Recordset
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Bakery.mdb"
End Sub
Listing / Coding :
Sub auto()
Dim no As String
Dim noint As Integer
With rstransaksi
If .RecordCount = 0 Then
no = "0001"
Else
.MoveLast
noint = Val(Right(!notrans, 4)) + 1
no = Right("0000" & noint, 4)
End If
End With
txtnotrans.Text = no
End Sub
Sub aktif()
txtnotrans.Enabled = True
txtkode.Enabled = True
txtproduct.Enabled = True
txtjenis.Enabled = True
txtrasa.Enabled = True
txtharga.Enabled = True
txtjumbel.Enabled = True
txttobay.Enabled = True
txtbayar.Enabled = True
txtkembali.Enabled = True
End Sub
Sub nonaktif()
txtnotrans.Enabled = False
txtkode.Enabled = False
txtproduct.Enabled = False
txtjenis.Enabled = False
txtrasa.Enabled = False
txtharga.Enabled = False
txtjumbel.Enabled = False
txttobay.Enabled = False
txtbayar.Enabled = False
txtkembali.Enabled = False
End Sub
Sub bersih()
txtnotrans.Text = ""
txtkode.Text = ""
txtproduct.Text = ""
txtjenis.Text = ""
txtrasa.Text = ""
txtharga.Text = ""
txtjumbel.Text = ""
txttobay.Text = ""
txtbayar.Text = ""
txtkembali.Text = ""
End Sub
Sub tampil()
With rskue
If Not .EOF Then
txtkode.Text = !kdkue
txtproduct.Text = !product
txtjenis.Text = !jenis_kue
txtrasa.Text = !rasa_kue
txtharga.Text = !harga
End If
End With
End Sub
Private Sub Form_Load()
Call koneksi
conn.CursorLocation = adUseClient
rstransaksi.Open "select * from Transaksi", conn
Set gridtransaksi.DataSource = rstransaksi.DataSource
End Sub
Private Sub Form_Activate()
nonaktif
bersih
cmdinput.Enabled = True
cmdsave.Enabled = False
cmddelete.Enabled = False
cmdcancel.Enabled = False
cmdexit.Enabled = True
cmdinput.Enabled = True
End Sub
Private Sub Timer1_Timer()
txttanggal.Text = Format(Date, "dd-mm-yyyy")
txttanggal.Enabled = False
End Sub
Private Sub cmdinput_Click()
aktif
bersih
auto
txtnotrans.Enabled = False
txtkode.SetFocus
cmdinput.Enabled = False
cmdsave.Enabled = True
cmddelete.Enabled = True
cmdcancel.Enabled = True
cmdexit.Enabled = True
End Sub
Private Sub cmdsave_Click()
Dim sqlsave As String
sqlsave = "insert into Transaksi values('" & txtnotrans.Text & "','" & txttanggal.Text & "','" & txtkode.Text & "','" & txtproduct & "','" & txtjenis.Text & "','" & txtrasa.Text & "','" & txtharga.Text & "','" & txtjumbel.Text & "','" & txttobay.Text & "')"
conn.Execute sqlsave
MsgBox "Data Telah Tersimpan"
Form_Load
nonaktif
cmdinput.Enabled = True
cmdsave.Enabled = False
cmddelete.Enabled = True
cmdcancel.Enabled = True
cmdexit.Enabled = True
End Sub
Private Sub cmdcancel_Click()
p = MsgBox("Yakin Ingin Membatalkan Penginputan..?!", vbQuestion + vbYesNo, "Question")
If p = vbYes Then
nonaktif
bersih
End If
cmdinput.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
cmddelete.Enabled = False
cmdexit.Enabled = True
End Sub
Private Sub cmddelete_Click()
Call koneksi
rstransaksi.Open "delete from Transaksi where notrans = '" & txtnotrans.Text & "'", conn
MsgBox "Data Telah Terhapus"
Form_Load
nonaktif
bersih
cmdinput.Enabled = True
cmdsave.Enabled = False
cmddelete.Enabled = True
cmdcancel.Enabled = True
cmdexit.Enabled = True
End Sub
Private Sub cmdexit_Click()
p = MsgBox("Yakin Ingin Keluar Dari Program Ini..?!", vbQuestion + vbYesNo, "Question")
If p = vbYes Then
End
End If
End Sub
Private Sub txtkode_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call koneksi
rskue.Open "select * from Kue where kdkue = '" & txtkode.Text & "'", conn
If rskue.EOF Then
MsgBox "Kode Yang Anda Masukan Tidak Ada"
txtkode.Text = ""
txtkode.SetFocus
Else
tampil
txtjumbel.SetFocus
End If
End If
End Sub
Private Sub txtjumbel_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttobay.Text = Val(txtjumbel.Text) * Val(txtharga.Text)
txtbayar.SetFocus
End If
End Sub
Private Sub txtbayar_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
MsgBox "Terima Kasih"
txtkembali.Text = Val(txtbayar.Text) - Val(txttobay.Text)
nonaktif
cmdsave.SetFocus
End If
End Sub
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :