T
tkraju via OfficeKB.com
I have Leave posting userform that updates leaves of employees.It has
Combobox1--List of employees
Combobox2--List Leave Names(only three values viz;CL,PL,SL)
TextBox1--Leave Begin Date
TextBox2--Leave End Date
TextBox3--CL balance days
TextBox4--PL balance days
TextBox5--SL balance days
CommandButton1--UpdateLeaveSheet
When selected a Employee name from ComboBox1 List,leave balances of selected
employee are fetched from LeaveSheet and displayed in TextBoxes 3,4 and 5.
I need code to check : 1.If TextBox 3,4,5 values are zero then promt msg"No
leave",disable commandButton1,exit sub.
2.if comboBox2 value "CL" and Textbox3 value is zero,msg"CL exhausted",
disable CommandButton1,exit sub.
3.if comboBox2 value "PL" and Textbox4 value is zero,msg"PL exhausted",
disable CommandButton1,exit sub.
4..if comboBox2 value "SL" and Textbox5 value is zero,msg"SL exhausted",
disable CommandButton1,exit sub.
5.if comboBox2 value "CL" and (Textbox2 value-TextBox1 value)+1 is greater
than TextBox3 value,msg"insufficient CL ,re-enter Leave end date ",clear and
select TextBox2.
6.if comboBox2 value "PL" and (Textbox2 value-TextBox1 value)+1 is greater
than TextBox4 value,msg"insufficient PL ,re-enter Leave end date ",clear and
select TextBox2.
7..if comboBox2 value "SL" and (Textbox2 value-TextBox1 value)+1 is greater
than TextBox5 value,msg"insufficient SL ,re-enter Leave end date ",clear and
select TextBox2.
Combobox1--List of employees
Combobox2--List Leave Names(only three values viz;CL,PL,SL)
TextBox1--Leave Begin Date
TextBox2--Leave End Date
TextBox3--CL balance days
TextBox4--PL balance days
TextBox5--SL balance days
CommandButton1--UpdateLeaveSheet
When selected a Employee name from ComboBox1 List,leave balances of selected
employee are fetched from LeaveSheet and displayed in TextBoxes 3,4 and 5.
I need code to check : 1.If TextBox 3,4,5 values are zero then promt msg"No
leave",disable commandButton1,exit sub.
2.if comboBox2 value "CL" and Textbox3 value is zero,msg"CL exhausted",
disable CommandButton1,exit sub.
3.if comboBox2 value "PL" and Textbox4 value is zero,msg"PL exhausted",
disable CommandButton1,exit sub.
4..if comboBox2 value "SL" and Textbox5 value is zero,msg"SL exhausted",
disable CommandButton1,exit sub.
5.if comboBox2 value "CL" and (Textbox2 value-TextBox1 value)+1 is greater
than TextBox3 value,msg"insufficient CL ,re-enter Leave end date ",clear and
select TextBox2.
6.if comboBox2 value "PL" and (Textbox2 value-TextBox1 value)+1 is greater
than TextBox4 value,msg"insufficient PL ,re-enter Leave end date ",clear and
select TextBox2.
7..if comboBox2 value "SL" and (Textbox2 value-TextBox1 value)+1 is greater
than TextBox5 value,msg"insufficient SL ,re-enter Leave end date ",clear and
select TextBox2.