[dba-VB] Just a Christmas quickie Using Not Instead of = False

Max Wanadoo max.wanadoo at gmail.com
Thu Dec 24 12:13:13 CST 2009


John,
I don't think that will work...something from Getz etc sticks in my
mind...might be old age though.

maxx

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: 24 December 2009 16:14
To: Discussion concerning Visual Basic and related programming issues.
Subject: Re: [dba-VB] Just a Christmas quickie Using Not Instead of = False

Paul,

Perhaps better would be:

if MyRecordset.BOF and MyRecordset.EOF then
	msgbox "Empty"
else
	do stuff here
endif

It is easier to read the true than the nots, especially when there is more
than one.  Either one 
works.  If this is in a tight loop and speed matters, then the NOT might
cause a very slight 
slowdown as it is two extra boolean operators.  OTOH the compiler might just
pick it up and rewrite 
it to my syntax anyway.

John W. Colby
www.ColbyConsulting.com


Paul Hartland wrote:
> To all,
> 
> I use a lot of recordsets, and to detect they actually contain something I
> have always used the following:
> 
> If myrecordset.bof=false and myrecordset.eof=false then
>     do my stuff here
> Else
>     msgbox "empty"
> End If
> 
> However my project manager prefers:
>  If not myrecordset.bof and not myrecordset.eof then
>     do my stuff here
> Else
>     msgbox "empty"
> End If
> 
> Is there actually a prefered way, or is one quicker than the other, or is
> there an even better way to do this ?
> 
> Thanks in advance for any comments, and a very merry christmas & happy new
> year to everyone.
> 
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list