1) Save Button Module :-
Let :- Module
Let :-
MS Excel Work Sheet Name = Sale
TextBox1 = Me.TextBoxPos_Entry_Id
CommandButton1 = CommandButtonPosEntryEdit
ListBox1 = ListBoxPos_Entry_Detail
TextBox1 = Me.TextBoxPos_Entry_Barcode1
TextBox2 = Me.TextBoxPos_Entry_Qty1
TextBox3 = Me.TextBoxPos_Entry_Rate1
TextBox4 = Me.TextBoxPos_Entry_Discount_Percentage1
TextBox5 = Me.TextBoxPos_Entry_Discount1
TextBox6 = Me.TextBoxPos_Entry_Taxtable_Value1
TextBox7 = Me.TextBoxPos_Entry_Amount1
TextBox8 = Me.TextBoxPos_Entry_Sales_Man1
Private Sub CommandButtonPosEntryEdit_Click()
'''''''''''validation'''''''''''
If Me.TextBoxPos_Entry_Barcode1.Value = "" Then
msgbox "Please Enter the Product Name", vbCritical
Exit Sub
End If
If IsNumeric(Me.TextBoxPos_Entry_Qty1.Value) = False Then
msgbox "Please Enter the Correct Purchase Price", vbCritical
Exit Sub
End If
If IsNumeric(Me.TextBoxPos_Entry_Rate1.Value) = False Then
msgbox "Please Enter the Correct Sale Price", vbCritical
Exit Sub
End If
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Sale")
''''''''''''Update Data
Dim lr As Integer
lr = Me.TextBoxPos_Entry_Id.Value
sh.Range("A" & lr + 1).Value = lr
sh.Range("B" & lr + 1).Value = Me.TextBoxPos_Entry_Barcode1.Value
sh.Range("C" & lr + 1).Value = Me.TextBoxPos_Entry_Qty1.Value
sh.Range("D" & lr + 1).Value = Me.TextBoxPos_Entry_Rate1.Value
sh.Range("E" & lr + 1).Value = Me.TextBoxPos_Entry_Discount_Percentage1.Value
sh.Range("F" & lr + 1).Value = Me.TextBoxPos_Entry_Discount1.Value
sh.Range("G" & lr + 1).Value = Me.TextBoxPos_Entry_Taxtable_Value1.Value
sh.Range("H" & lr + 1).Value = Me.TextBoxPos_Entry_Amount1.Value
sh.Range("I" & lr + 1).Value = Me.TextBoxPos_Entry_Sales_Man1.Value
''''''''''Clear Boxes
Me.TextBoxPos_Entry_Barcode1.Value = ""
Me.TextBoxPos_Entry_Qty1.Value = ""
Me.TextBoxPos_Entry_Rate1.Value = ""
Me.TextBoxPos_Entry_Discount_Percentage1.Value = ""
Me.TextBoxPos_Entry_Discount1.Value = ""
Me.TextBoxPos_Entry_Taxtable_Value1.Value = ""
Me.TextBoxPos_Entry_Amount1.Value = ""
Me.TextBoxPos_Entry_Sales_Man1.Value = ""
Call Show_Data
msgbox "Product has been Updated in Product Master", vbInformation
End Sub
No comments:
Post a Comment