![]() |
if condition skip to next line of code
hello all,
I am using the following if statement to evaluate conditions on my user form. My problem is how to handle if a text box has the value 0, i want the system to do nothing, and move to the next condition evaluation. Using Exit Sub busts right out of the block of code, and that isn't what works. How can i do this? If Me.txtNearMiss.Value = "0" Then exit sub ElseIf Not (Me.txtNearMiss.Value = "") And Me.txtDescNearMiss.Value = "" Then MsgBox "A value has been identified in the Near Miss Incidents field. A description of each incident is required." End if -- Carlee |
if condition skip to next line of code
don't know what your code looks like other than waht you posted, but you can try
this. the code will continue after the end if if Me.txtNearMiss.Value = 0 If Me.txtNearMiss.Value = "0" Then ' do nothing ElseIf Not (Me.txtNearMiss.Value = "") And Me.txtDescNearMiss.Value = "" Then MsgBox _ "A value has been identified in the Near Miss Incidents field. A description of each incident is required." End If -- Gary "Carlee" wrote in message ... hello all, I am using the following if statement to evaluate conditions on my user form. My problem is how to handle if a text box has the value 0, i want the system to do nothing, and move to the next condition evaluation. Using Exit Sub busts right out of the block of code, and that isn't what works. How can i do this? If Me.txtNearMiss.Value = "0" Then exit sub ElseIf Not (Me.txtNearMiss.Value = "") And Me.txtDescNearMiss.Value = "" Then MsgBox "A value has been identified in the Near Miss Incidents field. A description of each incident is required." End if -- Carlee |
if condition skip to next line of code
To do nothing? Have no code. Simply remove the line:
Exit Sub -- p45cal "Carlee" wrote: hello all, I am using the following if statement to evaluate conditions on my user form. My problem is how to handle if a text box has the value 0, i want the system to do nothing, and move to the next condition evaluation. Using Exit Sub busts right out of the block of code, and that isn't what works. How can i do this? If Me.txtNearMiss.Value = "0" Then exit sub ElseIf Not (Me.txtNearMiss.Value = "") And Me.txtDescNearMiss.Value = "" Then MsgBox "A value has been identified in the Near Miss Incidents field. A description of each incident is required." End if -- Carlee |
All times are GMT +1. The time now is 09:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com