If - Where's the End If

T

tcb

If you have many, many If statements within other If statements, is
there a handy way of finding the End If that corresponds to the If you
are working with? It would be great if you could shift + some
function key to get to that End If.
 
J

Jeff Boyce

Are you using indentation? Having a physical vertical alignment can help...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

boblarson

Not that I know of, but I use a thing called SMART INDENTER which is a free
tool that will indent your code for you. If you run it, then it is easier to
spot where you might be missing one, or have too many.

You can find Smart Indenter here:

http://www.oaltd.co.uk/Indenter/Default.htm

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
If my post was helpful to you, please rate the post.
__________________________________
 
F

fredg

If you have many, many If statements within other If statements, is
there a handy way of finding the End If that corresponds to the If you
are working with? It would be great if you could shift + some
function key to get to that End If.

There is no magic key that can tell you which End If belongs to which
end.

If you indent your code then the associated End if will align under
it's opening If and is easy to spot.
 
T

tcb

That Smart Indenter looks like a very nice tool, though I'm almost
afraid to try it. If the Smart Indenter can figure how to correctly
indent, it must be able to know which End If belongs to which IF, is
that true?

If that's the case, I wonder if a function could be created to do such
a thing. I am of course, looking for that magical keystroke. The
code I am working with is fairly well indented, but it is quite easy
to not have everything aligned just as you'd like it in countless rows
of code.

Thanks for your ideas!

Tom Benson
 
T

Tony Toews [MVP]

tcb said:
If you have many, many If statements within other If statements, is
there a handy way of finding the End If that corresponds to the If you
are working with? It would be great if you could shift + some
function key to get to that End If.

In addition to the other comments if your If statements are getting
that ugly then I wonder if your logic could use some working. For
example there is the

If
ElseIF
EndIf

or

Select Case <variable>
Case <value>
Case Else
End Select.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
Top