[AccessD] Slightly OT: VBScript Short-Circuit logic?

Jim DeMarco Jdemarco at hshhp.org
Tue Dec 23 11:29:11 CST 2003


The answer to your question is no.  Any thing you pass into OR is going to be evaluated (same is true in VB/VBA).

Try this code in VBA:

<snip>
Dim blnYes

    blnYes = True
    If blnYes Or CInt(70000) Then
        MsgBox "hi"
    End If
</snip>

You're going to get an overflow error even though blnYes = True.

HTH,

Jim DeMarco

-----Original Message-----
From: Joe Rojas [mailto:JRojas at tnco-inc.com]
Sent: Tuesday, December 23, 2003 9:53 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Slightly OT: VBScript Short-Circuit logic?


For example,

If I have an if statement like:

if rs.EOF or rs.fields("Somefield") = 1 then (rs is an ADODB recordset)

and EOF =True, I am receiving an error because vbscript is trying to execute
the rs.fields("Somefield") = 1 part and you can't do that when EOF.

It is not a big problem because I can code around this but I was hoping
vbscript would short-circuit on the rs.EOF part.

Thanks,
JR



-----Original Message-----
From: Jim DeMarco [mailto:Jdemarco at hshhp.org]
Sent: Tuesday, December 23, 2003 9:30 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Slightly OT: VBScript Short-Circuit logic?

What particular logic are you questioning?

Jim DeMarco

-----Original Message-----
From: Joe Rojas [mailto:JRojas at tnco-inc.com]
Sent: Tuesday, December 23, 2003 9:12 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Slightly OT: VBScript Short-Circuit logic?


Hi All,

Is it just me or does vbscript not use short-circuiting in its logic?

Thanks,
JR




This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please notify
the sender as soon as possible and destroy this message. While TNCO, Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability for
any damage caused by any virus transmitted by this email.
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


****************************************************************************
*******
"This electronic message is intended to be for the use only of the named
recipient, and may contain information from Hudson Health Plan (HHP) that is
confidential or privileged.  If you are not the intended recipient, you are
hereby notified that any disclosure, copying, distribution or use of the
contents of this message is strictly prohibited.  If you have received this
message in error or are not the named recipient, please notify us
immediately, either by contacting the sender at the electronic mail address
noted above or calling HHP at (914) 631-1611. If you are not the intended
recipient, please do not forward this email to anyone, and delete and
destroy all copies of this message.  Thank You".
****************************************************************************
*******

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please notify
the sender as soon as possible and destroy this message. While TNCO, Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability for
any damage caused by any virus transmitted by this email.
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


***********************************************************************************
"This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited.  If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message.  Thank You".
***********************************************************************************



More information about the AccessD mailing list