Codes
Codes
MODULE: INVENTORY
Sub Reset()
With frmForm
.txtNameofproduct.Value = ""
.txtPriceperproduct.Value = "'"
.txtQuantitysold.Value = ""
.cmbConsignesname.Clear
.cmbConsignesname.AddItem "Name1"
.cmbConsignesname.AddItem "Name2"
.cmbConsignesname.AddItem "Name3"
.cmbConsignesname.AddItem "Name4"
.txtIncome.Value = ""
.txt10.Value = ""
.lstDatabase.ColumnCount = 9
.lstDatabase.ColumnHeads = True
.lstDatabase.ColumnWidths = "40,80,80,80,70,50,30,50,40"
Else
.lstDatabase.RowSource = "DATABASE!A2:I2"
End If
End With
End Sub
Sub Submit()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("DATABASE")
iRow = [Counta(Database!A:A)] + 1
With sh
.Cells(iRow, 1) = iRow - 1
.Cells(iRow, 2) = frmForm.txtNameofproduct.Value
.Cells(iRow, 3) = frmForm.txtPriceperproduct.Value
.Cells(iRow, 4) = frmForm.txtQuantitysold.Value
.Cells(iRow, 5) = frmForm.cmbConsignesname.Value
.Cells(iRow, 6) = frmForm.txtIncome.Value
.Cells(iRow, 7) = frmForm.txt10.Value
.Cells(iRow, 8) = Application.UserName
End With
End Sub
Sub Show_FormfrmForm()
frmForm.Show
End Sub
BUTTONS: FRMFORM
msgValue = MsgBox("Do you want to reset the form?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Call Reset
End Sub
msgValue = MsgBox("Do you want to save the data?", vbYesNo + vbInformation, "Confirmation")
Call Submit
Call Reset
End Sub
Call Reset
End Sub