Hello............
my problem is with Msgbox.........
Below two codes
1 for searching the data (it is working smoothly.......but i want it gives following message) and 2. is for Modify the data
1. if textbox1 is blank and i hit commandbutton5 it gives a message (msgbox"Please enter an employee code")
2. When An employee code does not exist in Allpayment sheet, it should give a message (msgbox "Employee code does not exist")
3. When an employee code exist in Allpayment sheet, it should give a message (msgbox"Employee Pass")
2. I have also a commandbutton2 (Modify
In some cases i want to Modify the data of an employee code if it exist in "Allpayment" sheet but i am missing something in below code
if above said commandbutton5 shows the data of an employee code if found in "Allpayment", now i want to Modify the data which is displaying in Textbox2 to Textbox9.......when i hit the commandbutton2 it ask me to "are you want to modify the data" if i click Yes ((msgbox "Data updated") it modify the original data) if i click no (move the curser in textbox1 for searching another record)
thats it
my problem is with Msgbox.........
Below two codes
1 for searching the data (it is working smoothly.......but i want it gives following message) and 2. is for Modify the data
1. if textbox1 is blank and i hit commandbutton5 it gives a message (msgbox"Please enter an employee code")
2. When An employee code does not exist in Allpayment sheet, it should give a message (msgbox "Employee code does not exist")
3. When an employee code exist in Allpayment sheet, it should give a message (msgbox"Employee Pass")
Code:
[/COLOR][COLOR=#333333]Private Sub CommandButton5_Click()[/COLOR]
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Dim b As Long
Dim l As Range
b = Me.TextBox1.Value
Set l = Sheets("Allpayment").Range("a:a")
s = Application.WorksheetFunction.Match(b, l, 0)
Me.TextBox2.Value = Sheets("Allpayment").Cells(s, 2).Value
Me.TextBox3.Value = Sheets("Allpayment").Cells(s, 1).Value
Me.TextBox4.Value = Sheets("Allpayment").Cells(s, 3).Value
Me.TextBox5.Value = Sheets("Allpayment").Cells(s, 4).Value
Me.TextBox6.Value = Sheets("Allpayment").Cells(s, 5).Value
Me.TextBox7.Value = Sheets("Allpayment").Cells(s, 6).Value
Me.TextBox8.Value = Sheets("Allpayment").Cells(s, 7).Value
Me.TextBox9.Value = Sheets("Allpayment").Cells(s, 8).Value </code>[COLOR=#333333]End Sub[/COLOR][COLOR=#333333]
2. I have also a commandbutton2 (Modify
In some cases i want to Modify the data of an employee code if it exist in "Allpayment" sheet but i am missing something in below code
if above said commandbutton5 shows the data of an employee code if found in "Allpayment", now i want to Modify the data which is displaying in Textbox2 to Textbox9.......when i hit the commandbutton2 it ask me to "are you want to modify the data" if i click Yes ((msgbox "Data updated") it modify the original data) if i click no (move the curser in textbox1 for searching another record)
thats it
Code:
[/COLOR][COLOR=#333333]Private Sub CommandButton2_Click()[/COLOR][COLOR=#333333]<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">'edit button coding
Me.TextBox2.Enabled = True
Me.TextBox3.Enabled = True
Me.TextBox4.Enabled = True
Me.TextBox5.Enabled = True
Me.TextBox6.Enabled = True
Me.TextBox7.Enabled = True
Me.TextBox8.Enabled = True
Me.TextBox9.Enabled = True
End Sub</code><code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">
</code>
[/COLOR]
[COLOR=#333333]