Query - If statement

  • Thread starter Thread starter Pass-the-reality
  • Start date Start date
P

Pass-the-reality

On an old query I typed Not Started: IIf([Status]="Not Started",2) What
this did is if the status was listed as Not Started, it would put the number
2 in the row. How do I show that if there is not a date in the Rightfax
column than insert a 1 for example something like Fax:
IIf([Rightfax]=Null,1,0)
 
On an old query I typed   Not Started: IIf([Status]="Not Started",2)  What
this did is if the status was listed as Not Started, it would put the number
2 in the row.    How do I show that if there is not a date in the Rightfax
column than insert a 1 for example something like    Fax:
IIf([Rightfax]=Null,1,0)

IIF(IsNull([RightFax],1,0)
 
On an old query I typed Not Started: IIf([Status]="Not Started",2) What
this did is if the status was listed as Not Started, it would put the number
2 in the row. How do I show that if there is not a date in the Rightfax
column than insert a 1 for example something like Fax:
IIf([Rightfax]=Null,1,0)


IIF(IsNull([RightFax],1,0)

Piet,

You probably mean:

IIF(IsNull([RightFax]),1,0)

James A. Fortune
(e-mail address removed)
 
On an old query I typed Not Started: IIf([Status]="Not Started",2) What
this did is if the status was listed as Not Started, it would put the number
2 in the row. How do I show that if there is not a date in the Rightfax
column than insert a 1 for example something like Fax:
IIf([Rightfax]=Null,1,0)


IIF(IsNull([RightFax],1,0)

BTW, wouldn't it be better to use something built into JET SQL such as:

IIF([RightFax] IS NULL, 1, 0)

rather than the IsNull() function?

James A. Fortune
(e-mail address removed)
 
On Aug 5, 2:59 pm, Pass-the-reality
On an old query I typed   Not Started: IIf([Status]="Not Started",2)  What
this did is if the status was listed as Not Started, it would put the number
2 in the row.    How do I show that if there is not a date in the Rightfax
column than insert a 1 for example something like    Fax:
IIf([Rightfax]=Null,1,0)
IIF(IsNull([RightFax],1,0)

Piet,

You probably mean:

IIF(IsNull([RightFax]),1,0)

James A. Fortune
(e-mail address removed)

Yeah, I can sort of think straight, but I can't type for beans!
 
Or use -IsNull([RightFax])

Pieter

James A. Fortune said:
On an old query I typed Not Started: IIf([Status]="Not Started",2)
What
this did is if the status was listed as Not Started, it would put the
number
2 in the row. How do I show that if there is not a date in the
Rightfax
column than insert a 1 for example something like Fax:
IIf([Rightfax]=Null,1,0)


IIF(IsNull([RightFax],1,0)

BTW, wouldn't it be better to use something built into JET SQL such as:

IIF([RightFax] IS NULL, 1, 0)

rather than the IsNull() function?

James A. Fortune
(e-mail address removed)
 
Pieter said:
Or use -IsNull([RightFax])

Pieter

In:

http://groups.google.com/group/comp.databases.ms-access/msg/bd9eb4cb3af5a672

Steve Jorgensen says:

"That was my thought as well, but it would only be an issue if the
database is an ADP or ADE. Otherwise, the expression service would
forward the IsNull call to the expression service which would hand it
off to VBA.

Of couse, in any quuery [sic], JET or T-SQL, you can and should use the
IS NULL operator to check for nulls, not the IsNull function."

In almost all cases the benefit is not large enough to be noticed, but
the cost of getting the benefit is right. Perhaps even the use of the
NZ() function in a query is slightly questionable.

James A. Fortune
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top