Coding Form Keluar
Coding Form Keluar
Coding Form Keluar
Exit Sub
EXCELVBA:
Call MsgBox("Maaf, data Customer tidak ditemukan", vbInformation, "Data Customer")
End Sub
Me.TXTSTOK.Enabled = False
Me.TXTSISA.Enabled = False
Exit Sub
EXCELVBA:
Call MsgBox("Maaf, Id barang belum terdaftar", vbInformation, "Data Barang")
End Sub
If Me.TXTIDTRANSAKSI.Value = "" _
Or Me.TXTTANGGAL.Value = "" _
Or Me.CBIDBARANG.Value = "" _
Or Me.TXTKELUAR.Value = "" Then
Call MsgBox("Isi data barang masuk dengan lengkap", vbInformation, "Barang Masuk")
Else
DBMASUK.Offset(1, 0).Value = "=ROW()-ROW(BARANGMASUK!$A$3)"
DBMASUK.Offset(1, 1).Value = Me.TXTIDTRANSAKSI.Value
DBMASUK.Offset(1, 2).Value = Format(Me.TXTTANGGAL.Value, "MM/DD/YYYY")
DBMASUK.Offset(1, 3).Value = Format(Me.TXTTANGGAL.Value, "MMMM")
DBMASUK.Offset(1, 4).Value = Format(Me.TXTTANGGAL.Value, "YYYY")
DBMASUK.Offset(1, 5).Value = Me.CBCUSTOMER.Value
DBMASUK.Offset(1, 6).Value = Me.TXTALAMAT.Value
DBMASUK.Offset(1, 7).Value = Me.CBIDBARANG.Value
DBMASUK.Offset(1, 8).Value = Me.TXTNAMABARANG.Value
DBMASUK.Offset(1, 9).Value = Me.TXTSATUAN.Value
DBMASUK.Offset(1, 10).Value = Me.TXTGUDANG.Value
DBMASUK.Offset(1, 11).Value = Me.TXTKELUAR.Value
DBMASUK.Offset(1, 12).Value = Me.TXTHARGA.Value
DBMASUK.Offset(1, 13).Value = Me.TXTTOTAL.Value
End Sub
Private Sub InputSurat()
Dim DBMASUK As Object
Dim UpdateStok As Object
End Sub
If TData = 0 Then
Me.CBIDBARANG.RowSource = ""
Else
Me.CBIDBARANG.RowSource = "PRODUK!B6:C" & iRow
End If
End Sub
Private Sub AmbilData()
Dim TData As Long
Dim iRow As Long
iRow = Sheet7.Range("A" & Rows.Count).End(xlUp).Row
TData = Application.WorksheetFunction.CountA(Sheet7.Range("A4:A100000"))
If TData = 0 Then
Me.TABELDATA.RowSource = ""
Else
Me.TABELDATA.RowSource = "BARANGKELUAR!A4:N" & iRow
End If
Me.TXTTOTALBARANG.Value = Me.TABELDATA.ListCount
End Sub
Exit Sub
Salah:
Call MsgBox("Maaf Data tidak ditemukan", vbInformation, "Cari Data")
End Sub
End Sub
If TData = 0 Then
Me.TABELDATA.RowSource = ""
Else
Me.TABELDATA.RowSource = "SURATJALAN!A15:F" & iRow
End If
End Sub
Private Sub CMDDELETE_Click()
On Error GoTo EXCELVBA
Application.ScreenUpdating = False
Dim UpdateStok As Object
Set UpdateStok = Sheet3.Range("B6:B10000").Find(What:=Me.TXTIDBARANG.Value,
LookIn:=xlValues)
Me.TABELDATA.Value = ""
If Me.TXTIDHAPUS.Value = "" Then
Call MsgBox("Pilih data pada tabel data", vbInformation, "Hapus Data")
Else
'Membuat pesan konfirmasi hapus data
Select Case MsgBox("Anda akan menghapus data" _
& vbCrLf & "Apakah anda yakin?" _
, vbYesNo Or vbQuestion Or vbDefaultButton1, "Hapus data")
Case vbNo
Exit Sub
Case vbYes
End Select
Sheet7.Select
Selection.EntireRow.Delete
UpdateStok.Offset(0, 3).Value = UpdateStok.Offset(0, 3).Value +
Val(Me.STOKHAPUS.Value)
UpdateStok.Offset(0, 6).Value = Val(UpdateStok.Offset(0, 3).Value) *
Val(UpdateStok.Offset(0, 5).Value)
Call AmbilData
Sheet1.Select
End If
Exit Sub
EXCELVBA:
Call MsgBox("Data barang pada tabel Produk tidak ditemukan", vbInformation, "Hapus
Data")
End Sub
End Sub
Call AmbilData
'Sheet1.Select
End If
End Sub
End Sub
Me.TXTSISA.Value = Me.TXTSTOK.Value
Me.STOKHAPUS.Value = Me.TABELDATA.Column(11)
Me.TXTIDBARANG.Value = Me.TABELDATA.Column(7)
Sheet7.Select
SUMBERUBAH = Sheets("BARANGKELUAR").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("BARANGKELUAR").Range("A4:A" & SUMBERUBAH).Find(What:=Me.TXTNOMOR.Value,
LookIn:=xlValues, LookAt:=xlWhole).Activate
CELLAKTIF = ActiveCell.Row
Me.CMDDELETE.Enabled = True
Me.CMDADD.Enabled = False
Me.TXTIDTRANSAKSI.Enabled = False
Me.CMDBARU.Enabled = False
Me.TXTIDHAPUS.Enabled = False
Me.STOKHAPUS.Enabled = False
Me.TXTIDBARANG.Enabled = False
Sheet1.Select
Exit Sub
EXCELVBA:
Call MsgBox("Anda sedang membuka data Surat Jalan, silahkan klik tombol Reset
terlebih dahulu", vbInformation, "Data Surat")
End Sub
Private Sub TXTKELUAR_Change()
On Error Resume Next
Me.TXTSISA.Value = Val(Me.TXTSTOK.Value) + Val(Me.STOKHAPUS.Value) -
Val(Me.TXTKELUAR.Value)
Me.TXTTOTAL.Value = Val(Me.TXTKELUAR.Value) * Val(Me.TXTHARGA.Value)
End Sub
If TData = 0 Then
Me.CBCUSTOMER.RowSource = ""
Else
Me.CBCUSTOMER.RowSource = "CUSTOMER!C6:C" & iRow
End If
End Sub