473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

If Endif on one line: possible?

Is it possible to code and if-endif statement on one line of code? I have a
bunch of small if-endif statements that would make my code look a lot
simpler if I could put them in one line.
Thanks,
john
Jun 24 '07 #1
4 8464
An If statement that can be entered entirely on one line doesn't need an End
If!

If ControlA ControlB Then ControlC.SetFocus

or

If MyDate = Date() Then MsgBox "Today's the Day!"

are both valid.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200706/1

Jun 24 '07 #2
Thanks!
john

"missinglinq via AccessMonster.com" <u28780@uweschreef in bericht
news:742c4f6239a1a@uwe...
An If statement that can be entered entirely on one line doesn't need an
End
If!

If ControlA ControlB Then ControlC.SetFocus

or

If MyDate = Date() Then MsgBox "Today's the Day!"

are both valid.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200706/1

Jun 24 '07 #3
You can also use a colon to put multiple statements within a single If
statement on one line, without an End If. Example:

If a = b Then Msgbox "a = b": Exit Sub

Neil
"John" <jo@hn.comwrote in message
news:f5***********@textnews.wanadoo.nl...
Thanks!
john

"missinglinq via AccessMonster.com" <u28780@uweschreef in bericht
news:742c4f6239a1a@uwe...
>An If statement that can be entered entirely on one line doesn't need an
End
If!

If ControlA ControlB Then ControlC.SetFocus

or

If MyDate = Date() Then MsgBox "Today's the Day!"

are both valid.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200706/1


Jun 24 '07 #4
Great. thanks.
john

"Neil" <no****@nospam.netschreef in bericht
news:kj*****************@newssvr17.news.prodigy.ne t...
You can also use a colon to put multiple statements within a single If
statement on one line, without an End If. Example:

If a = b Then Msgbox "a = b": Exit Sub

Neil
"John" <jo@hn.comwrote in message
news:f5***********@textnews.wanadoo.nl...
>Thanks!
john

"missinglinq via AccessMonster.com" <u28780@uweschreef in bericht
news:742c4f6239a1a@uwe...
>>An If statement that can be entered entirely on one line doesn't need an
End
If!

If ControlA ControlB Then ControlC.SetFocus

or

If MyDate = Date() Then MsgBox "Today's the Day!"

are both valid.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200706/1



Jun 24 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: prettysmurfed | last post by:
Hi all I have this, probably stupid question, how to avoid multiple definitions when a header file is included more than once. I thought, when you wrote the header-file and used the...
6
by: boki | last post by:
Dear All, Could you please tell me what is a "#" stand for in c++? Why there is "#if 1" in program description? It go with "#endif" Could you please explain it? thank you very much.
1
by: Christopher M. Lusardi | last post by:
Hello, Is there anyway to do it other than using : #ifdef VAR1 ... #endif
1
by: MarkN | last post by:
Hi All, I'm trying to use the <% if %> ... <% endif%> construct in the body of an aspx page to conditionally display a table row. The table row is displaying regardless of the condition result...
1
by: mohan | last post by:
Hi All, I have large file coded consisting of function implemented in c. This function consissts of #if macro and corresponding. And somewhere in the function i am missing to put #endif , Is...
0
by: Fabio R. | last post by:
I'm going crazy... Can someone help me to do a regex to search for something like nested if? I have these tags: <if>...<else>...<endif> that can be nested: <if> <if>...<else>...<endif>
7
by: MLH | last post by:
Would love to be able to click on any If-statement and launch a utility that would find what A97 believes to be its corresponding EndIf. Such a tool would save me lots of time as I am forever...
14
by: lawjake | last post by:
I am having a dispute at work over endifs, and cannot find any treatise on this. So I am hoping that I can get a lot of correspondece confirming my belief. Here it is: I believe the following:...
5
by: ma | last post by:
Hello, I want to write something such as : enum x{ x1=0,
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.