null value

  • Thread starter Thread starter NetworkTrade
  • Start date Start date
N

NetworkTrade

Access02

have need for a conditionally visible label in group header & footer
OnFormat.

have made it into a text box and put into the control:
=IIf(IsNull([Name]),"Testing"," ")

Not working. Sanity tested this:
=IIf(([Name]<>"test"),"Testing"," ")
and this works

Sanity tested this
=IIf(([Name]=""),"Testing"," ")
does not work

Underlying query shows just blanks in field and so am perplexed as to why
the IsNull does not work.....
 
Is your field really called Name? If so, Access may misunderstand it as the
name property of the report, rather than the Name field. Since the report
always has a name, it's never null.

Try aliasing the field in the query, by typing an expression like this in
the Field row:
TheName: [Name]
Then in the report, change the Name property of the control to (say)
txtTheName, and try Contol Source:
=IIf([TheName] Is Null, "It's null", "It's " & Len([TheName]) & "
characters")
 
yep bingo sloppy mistake on my part...

changed control name and it works as should.....

--
NTC


Allen Browne said:
Is your field really called Name? If so, Access may misunderstand it as the
name property of the report, rather than the Name field. Since the report
always has a name, it's never null.

Try aliasing the field in the query, by typing an expression like this in
the Field row:
TheName: [Name]
Then in the report, change the Name property of the control to (say)
txtTheName, and try Contol Source:
=IIf([TheName] Is Null, "It's null", "It's " & Len([TheName]) & "
characters")

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

NetworkTrade said:
Access02

have need for a conditionally visible label in group header & footer
OnFormat.

have made it into a text box and put into the control:
=IIf(IsNull([Name]),"Testing"," ")

Not working. Sanity tested this:
=IIf(([Name]<>"test"),"Testing"," ")
and this works

Sanity tested this
=IIf(([Name]=""),"Testing"," ")
does not work

Underlying query shows just blanks in field and so am perplexed as to why
the IsNull does not work.....
 
Excellent! Solved.

FYI, you might be surprised to know there are well over 2000 field names
that can cause you grief. Many are unlikely, but others such as Name, Date,
Year, Day, ... even ProductCode are real traps.

Here's a list you can refer to when designing your tables:
http://allenbrowne.com/AppIssueBadWord.html
 
Back
Top