View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default 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