Coding Form Barang
Coding Form Barang
Coding Form Barang
With CMBKATEGORI
.AddItem "Makanan"
.AddItem "Minuman"
.AddItem "Snack"
.AddItem "Mie Instan"
End With
With CMBSATUAN1
.AddItem "Kg"
.AddItem "Liter"
.AddItem "PCS"
.AddItem "Kotak"
.AddItem "Kardus"
.AddItem "Buah"
.AddItem "Lusin"
End With
With CMBSATUAN2
.AddItem "Kg"
.AddItem "Liter"
.AddItem "PCS"
.AddItem "Kotak"
.AddItem "Kardus"
.AddItem "Buah"
.AddItem "Lusin"
End With
With CMBSATUAN3
.AddItem "Kg"
.AddItem "Liter"
.AddItem "PCS"
.AddItem "Kotak"
.AddItem "Kardus"
.AddItem "Buah"
.AddItem "Lusin"
End With
If Me.TXTKODE.Value = "" _
Or Me.TXTNAMABARANG.Value = "" _
Or Me.CMBKATEGORI.Value = "" _
Or Me.TXTHARGABELI.Value = "" _
Or Me.CMBSATUAN.Value = "" _
Or Me.TXTISI.Value = "" Then
Call MsgBox("Harap isi data barang dengan lengkap", vbInformation, "Data Barang")
Else
FileCopy ErwinG, ThisWorkbook.Path & "\" & "FolderGambar" & "\" & GBARANG & ".jpg"
DbBarang.Offset(1, 0).Value = Me.TXTKODE.Value
DbBarang.Offset(1, 1).Value = Me.TXTNAMABARANG.Value
DbBarang.Offset(1, 2).Value = Me.CMBKATEGORI.Value
DbBarang.Offset(1, 3).Value = Me.TXTHARGABELI.Value
DbBarang.Offset(1, 4).Value = Me.CMBSATUAN.Value
DbBarang.Offset(1, 5).Value = Me.TXTISI.Value
Me.Image1.Picture = Nothing
Me.TXTKODE.Value = ""
Me.TXTNAMABARANG.Value = ""
Me.CMBKATEGORI.Value = ""
Me.TXTHARGABELI.Value = ""
Me.CMBSATUAN.Value = ""
Me.TXTISI.Value = ""
Me.TXTHARGA1.Value = ""
Me.CMBSATUAN1.Value = ""
Me.TXTISI1.Value = ""
Me.TXTHARGA2.Value = ""
Me.CMBSATUAN2.Value = ""
Me.TXTISI2.Value = ""
Me.TXTHARGA3.Value = ""
Me.CMBSATUAN3.Value = ""
Me.TXTISI3.Value = ""
Me.TXTGAMBAR.Value = ""
End If
Exit Sub
EXCELVBA:
Call MsgBox("Folder penyimpanan gambar belum diatur, silahkan tekan tombol folder untuk
membuat folder penyimpanan gambar", vbInformation, "Simpan Gambar")
Me.TXTHARGA1.Value = Me.TABELBARANG.Column(6)
Me.CMBSATUAN1.Value = Me.TABELBARANG.Column(7)
Me.TXTISI1.Value = Me.TABELBARANG.Column(8)
Me.TXTHARGA2.Value = Me.TABELBARANG.Column(9)
Me.CMBSATUAN2.Value = Me.TABELBARANG.Column(10)
Me.TXTISI2.Value = Me.TABELBARANG.Column(11)
Me.TXTHARGA3.Value = Me.TABELBARANG.Column(12)
Me.CMBSATUAN3.Value = Me.TABELBARANG.Column(13)
Me.TXTISI3.Value = Me.TABELBARANG.Column(14)
Me.TXTGAMBAR.Value = Me.TABELBARANG.Column(15)
Me.Image1.Picture = LoadPicture(Me.TXTGAMBAR.Value)
Me.Image1.PictureSizeMode = 1
Me.CMDTAMBAH.Enabled = False
Sheet2.Select
SUMBERUBAH = Sheets("DATABARANG").Cells(Rows.Count, "B").End(xlUp).Row
Sheets("DATABARANG").Range("B6:B" & SUMBERUBAH).Find(What:=Me.TXTKODE.Value,
LookIn:=xlValues, LookAt:=xlWhole).Activate
CELLAKTIF = ActiveCell.Row
Sheets("DATABARANG").Range("B" & CELLAKTIF & ":Q" & CELLAKTIF).Select
Sheet1.Select
Exit Sub
EXCELVBA:
Call MsgBox("Klik 2x pada data yang tersedia", vbInformation, "Pilih Data")
Cells(BARIS, 8) = Me.TXTHARGA1.Value
Cells(BARIS, 9) = Me.CMBSATUAN1.Value
Cells(BARIS, 10) = Me.TXTISI1.Value
Me.TXTKODE.Value = ""
Me.TXTNAMABARANG.Value = ""
Me.CMBKATEGORI.Value = ""
Me.TXTHARGABELI.Value = ""
Me.CMBSATUAN.Value = ""
Me.TXTISI.Value = ""
Me.TXTHARGA1.Value = ""
Me.CMBSATUAN1.Value = ""
Me.TXTISI1.Value = ""
Me.TXTHARGA2.Value = ""
Me.CMBSATUAN2.Value = ""
Me.TXTISI2.Value = ""
Me.TXTHARGA3.Value = ""
Me.CMBSATUAN3.Value = ""
Me.TXTISI3.Value = ""
Me.TXTGAMBAR.Value = ""
Me.Image1.Picture = Nothing
End If
Sheet1.Select
Me.TXTKODE.Value = ""
Me.TXTNAMABARANG.Value = ""
Me.CMBKATEGORI.Value = ""
Me.TXTHARGABELI.Value = ""
Me.CMBSATUAN.Value = ""
Me.TXTISI.Value = ""
Me.TXTHARGA1.Value = ""
Me.CMBSATUAN1.Value = ""
Me.TXTISI1.Value = ""
Me.TXTHARGA2.Value = ""
Me.CMBSATUAN2.Value = ""
Me.TXTISI2.Value = ""
Me.TXTHARGA3.Value = ""
Me.CMBSATUAN3.Value = ""
Me.TXTISI3.Value = ""
Me.TXTGAMBAR.Value = ""
Call UrutBarang
End If
9. CODING RESET
Me.TXTKODE.Value = ""
Me.TXTNAMABARANG.Value = ""
Me.CMBKATEGORI.Value = ""
Me.TXTHARGABELI.Value = ""
Me.CMBSATUAN.Value = ""
Me.TXTISI.Value = ""
Me.TXTHARGA1.Value = ""
Me.CMBSATUAN1.Value = ""
Me.TXTISI1.Value = ""
Me.TXTHARGA2.Value = ""
Me.CMBSATUAN2.Value = ""
Me.TXTISI2.Value = ""
Me.TXTHARGA3.Value = ""
Me.CMBSATUAN3.Value = ""
Me.TXTISI3.Value = ""
Me.TXTGAMBAR.Value = ""
Me.CMDTAMBAH.Enabled = True