473,805 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Better syntax?

MLH
If Not IsNull(DLookup( "[YR]", "tblCars", "[VID]=GetCurrVID()") ) Then

If DLookup("[YR]", "tblCars", "[VID]=GetCurrVID()") Then

Of the above 2 syntax variations, is the 2nd unacceptable? I use the
former because I seem to remember suggestions in this forum that
discouraged the latter. But I tire of it. To me, the latter is more
readily understood because there's no double negative to deal with.
May 19 '06 #1
3 1318
MLH wrote:
If Not IsNull(DLookup( "[YR]", "tblCars", "[VID]=GetCurrVID()") ) Then

If DLookup("[YR]", "tblCars", "[VID]=GetCurrVID()") Then

Of the above 2 syntax variations, is the 2nd unacceptable? I use the
former because I seem to remember suggestions in this forum that
discouraged the latter. But I tire of it. To me, the latter is more
readily understood because there's no double negative to deal with.


If the value of [YR] returned is zero or null then the expression will not work
as expected.

If the criteria finds no rows you will get null back (not false).

Using DCount() instead of DLookup() would solve both of those problems, but
might take a few more clicks to resolve.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
May 19 '06 #2

"MLH" <CR**@NorthStat e.net> wrote in message
news:11******** *************** *********@4ax.c om...
If Not IsNull(DLookup( "[YR]", "tblCars", "[VID]=GetCurrVID()") ) Then

If DLookup("[YR]", "tblCars", "[VID]=GetCurrVID()") Then

Of the above 2 syntax variations, is the 2nd unacceptable? I use the
former because I seem to remember suggestions in this forum that
discouraged the latter. But I tire of it. To me, the latter is more
readily understood because there's no double negative to deal with.


If NZ(DLookup("[YR]", "tblCars", "[VID]=GetCurrVID()") , 0) <> 0 Then

Assuming [YR] = 0 is not acceptable ,
May 19 '06 #3
MLH
On Fri, 19 May 2006 02:39:14 GMT, "Rick Brandt"
<ri*********@ho tmail.com> wrote:
MLH wrote:
If Not IsNull(DLookup( "[YR]", "tblCars", "[VID]=GetCurrVID()") ) Then

If DLookup("[YR]", "tblCars", "[VID]=GetCurrVID()") Then

Of the above 2 syntax variations, is the 2nd unacceptable? I use the
former because I seem to remember suggestions in this forum that
discouraged the latter. But I tire of it. To me, the latter is more
readily understood because there's no double negative to deal with.


If the value of [YR] returned is zero or null then the expression will not work
as expected.

If the criteria finds no rows you will get null back (not false).

Using DCount() instead of DLookup() would solve both of those problems, but
might take a few more clicks to resolve.

=============== =============== =============
I see your point. I can rid myself of the dbl-neg situation
easily enough by reversing the Do This or Do That. But
I think I like your DCount suggestion better.

If [double-negative condition] Then
Do THIS if true
Else
Do THAT if false
Endif
If [straight-forward condition w/ NO dbl-neg] Then
Do THAT if true
Else
Do THIS if false
Endif
May 19 '06 #4

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

Similar topics

220
19199
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
16
697
by: Bhushit Joshipura | last post by:
This post contains one question and one proposal. A. May I know why order of evaluation of arguments is not specified in C/C++? I asked a question in comp.lang.c++ for the following possibility and because the languages do not specify the order of evaluation, doing so was an error. int B::f ( int i, int j = i + 1 ) { // j defaults to i + 1
85
3305
by: masood.iqbal | last post by:
I know that this topic may inflame the "C language Taleban", but is there any prospect of some of the neat features of C++ getting incorporated in C? No I am not talking out the OO stuff. I am talking about the non-OO stuff, that seems to be handled much more elegantly in C++, as compared to C. For example new & delete, references, consts, declaring variables just before use etc. I am asking this question with a vested interest. I...
43
3432
by: Rob R. Ainscough | last post by:
I realize I'm learning web development and there is a STEEP learning curve, but so far I've had to learn: HTML XML JavaScript ASP.NET using VB.NET ..NET Framework ADO.NET SSL
4
1174
by: telesphore4 | last post by:
Is there a better way to make the subclassing of built-in types stick? The goal is to have the the fields of a class behave like strings with extra methods attached. That is, I want the fact that the fields are not strings to be invisible to the client programmers. But I always want the extras to be there for the clients too. What I'm doing is subclassing str. Of course, whenever you then set mystr = 'a string' you loose the extra...
1
1475
by: MLH | last post by:
I have an A97 application with a form (frmEditOwners). Here's a code snippet for deleting current record... Private Sub DelOwnerRecBtn_Click() On Error GoTo Err_btnCloseOwnerEditForm_Click Dim ThisForm As String, MyReply As Byte ThisForm = Me.Name DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
22
2725
by: JoeC | last post by:
I am working on another game project and it is comming along. It is an improvment over a previous version I wrote. I am trying to write better programs and often wonder how to get better at programming. I tend to learn what is useful and gets the job done. I am always curious if there is some techique I don't know. I read books and study as well as write programs. My goal is to some day be able to get a job programming. I have a...
23
6605
by: Ali Bobo | last post by:
1. PHP.NET the greatest API resource known to MAN 2. If you have a problem, someone will have already implemented a solution in PHP for you 3. Syntax is better, closer to C, C++, and Java. Unlike VB where anything goes. 4. To run ASP you need IIS on windows, which is not free, for PHP however you need Linux and Apache which are FREE!! 5. Great built in support for ftp, email, graphics package GD2 and also MySQL (also FREE). 6. PHP will...
6
1348
by: Christopher Vogt | last post by:
Hej everybody, I built something for myself that might help some of you as well. Looking at a couple of PHP template engines made me think. I have two main requirements for a presentation layer framework: - use PHP as the template language - effective XSS prevention without betting on discipline Plain PHP only satisfies the first. I could not find a PHP template
25
1878
by: tmallen | last post by:
I'm parsing some text files, and I want to strip blank lines in the process. Is there a simpler way to do this than what I have here? lines = filter(lambda line: len(line.strip()) 0, lines) Thomas
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10609
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7646
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5542
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3845
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.