Conditionally formatting a null value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a bunch of tasks which need key personnel assigned... 4 personnel with
different job titles for each task. I want to develop a report based on a
query which shows me when one or more of the "key players" for a task remains
unassigned. In my report, I want null fields to have the word "Need" in bold
face. How do I do this? Here's what I tried:

=IIf([field_name_for_personnel_title]="","Need","")
 
If it's Null, you need to check IsNull([field_name_for_personnel_title]),
not [field_name_for_personnel_title]=""

If it's possible that some might be Null, whereas others might be a
zero-length string, try
Len([field_name_for_personnel_title]&"") = 0, or even
Len(Trim([field_name_for_personnel_title]&"")) = 0
 
When I try that, all results under that field name come up void - even
records that have personnel assigned. I also tried substituting the field
name (in brackets) for Null @ the end of your expression and still came up
void. Any ideas?
--
Again, thanks for your time!


Allen Browne said:
Try:
=IIf(IsNull([field_name_for_personnel_title]),"Need", Null)

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

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

NC_Sue said:
I have a bunch of tasks which need key personnel assigned... 4 personnel
with
different job titles for each task. I want to develop a report based on a
query which shows me when one or more of the "key players" for a task
remains
unassigned. In my report, I want null fields to have the word "Need" in
bold
face. How do I do this? Here's what I tried:

=IIf([field_name_for_personnel_title]="","Need","")
 
I know I'm slow, but I'm a newbie at writing expressions in Access. Can you
spell out the entire expression? Seems like however I try to plug your
suggestion into an Iif expression, I get error messages.... or when I try the
other suggestion left by someone else responding to this string, all results
under that field name come up void - even records that have personnel
assigned. I also tried substituting the field name (in brackets) for Null @
the end of your expression and still came up void.

Any help you can provide will be greatly appreciated.
--
Thanks for your time!


Douglas J. Steele said:
If it's Null, you need to check IsNull([field_name_for_personnel_title]),
not [field_name_for_personnel_title]=""

If it's possible that some might be Null, whereas others might be a
zero-length string, try
Len([field_name_for_personnel_title]&"") = 0, or even
Len(Trim([field_name_for_personnel_title]&"")) = 0


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



NC_Sue said:
I have a bunch of tasks which need key personnel assigned... 4 personnel
with
different job titles for each task. I want to develop a report based on a
query which shows me when one or more of the "key players" for a task
remains
unassigned. In my report, I want null fields to have the word "Need" in
bold
face. How do I do this? Here's what I tried:

=IIf([field_name_for_personnel_title]="","Need","")
 
Ask Access what is in the field.

Make sure you have a text box on the report, with its Name and Control
Source both set to:
field_name_for_personnel_title

Beside that text box, place another one with Control Source of:
=TypeName([field_name_for_personnel_title].[Value])

Where the field_name_for_personnel_title field looks blank, is Access
telling you that it is a String or a Null?

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

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

NC_Sue said:
When I try that, all results under that field name come up void - even
records that have personnel assigned. I also tried substituting the field
name (in brackets) for Null @ the end of your expression and still came up
void. Any ideas?
--
Again, thanks for your time!


Allen Browne said:
Try:
=IIf(IsNull([field_name_for_personnel_title]),"Need", Null)


NC_Sue said:
I have a bunch of tasks which need key personnel assigned... 4 personnel
with
different job titles for each task. I want to develop a report based on
a
query which shows me when one or more of the "key players" for a task
remains
unassigned. In my report, I want null fields to have the word "Need" in
bold
face. How do I do this? Here's what I tried:

=IIf([field_name_for_personnel_title]="","Need","")
 
I don't see where it indicates either one - string or null.
Obviously I'm confused.
Probably I'm even confusing.

Perhaps the best thing is to give you an actual field name where I'm trying
to do this - one of them is PI (the letters P & I, no spaces). How would you
write this expression?

Thanks again - sorry to be a pest.


--
Thanks for your time!


Allen Browne said:
Ask Access what is in the field.

Make sure you have a text box on the report, with its Name and Control
Source both set to:
field_name_for_personnel_title

Beside that text box, place another one with Control Source of:
=TypeName([field_name_for_personnel_title].[Value])

Where the field_name_for_personnel_title field looks blank, is Access
telling you that it is a String or a Null?

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

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

NC_Sue said:
When I try that, all results under that field name come up void - even
records that have personnel assigned. I also tried substituting the field
name (in brackets) for Null @ the end of your expression and still came up
void. Any ideas?
--
Again, thanks for your time!


Allen Browne said:
Try:
=IIf(IsNull([field_name_for_personnel_title]),"Need", Null)


I have a bunch of tasks which need key personnel assigned... 4 personnel
with
different job titles for each task. I want to develop a report based on
a
query which shows me when one or more of the "key players" for a task
remains
unassigned. In my report, I want null fields to have the word "Need" in
bold
face. How do I do this? Here's what I tried:

=IIf([field_name_for_personnel_title]="","Need","")
 
You can try:
=IIf(Len(Nz([PI], "")) = 0, "Need", Null)

However, I suspect something else is going on here, as the previous attempts
to identify what's what have been unfruitful.

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

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

NC_Sue said:
I don't see where it indicates either one - string or null.
Obviously I'm confused.
Probably I'm even confusing.

Perhaps the best thing is to give you an actual field name where I'm
trying
to do this - one of them is PI (the letters P & I, no spaces). How would
you
write this expression?

Thanks again - sorry to be a pest.


--
Thanks for your time!


Allen Browne said:
Ask Access what is in the field.

Make sure you have a text box on the report, with its Name and Control
Source both set to:
field_name_for_personnel_title

Beside that text box, place another one with Control Source of:
=TypeName([field_name_for_personnel_title].[Value])

Where the field_name_for_personnel_title field looks blank, is Access
telling you that it is a String or a Null?

NC_Sue said:
When I try that, all results under that field name come up void - even
records that have personnel assigned. I also tried substituting the
field
name (in brackets) for Null @ the end of your expression and still came
up
void. Any ideas?
--
Again, thanks for your time!


:

Try:
=IIf(IsNull([field_name_for_personnel_title]),"Need", Null)


I have a bunch of tasks which need key personnel assigned... 4
personnel
with
different job titles for each task. I want to develop a report based
on
a
query which shows me when one or more of the "key players" for a
task
remains
unassigned. In my report, I want null fields to have the word "Need"
in
bold
face. How do I do this? Here's what I tried:

=IIf([field_name_for_personnel_title]="","Need","")
 
I think I'm just going to print off the report and highlight the blanks....

;)

I tried your suggestion & it formatted fields which had a value. What I'd
like is to see is the word "Need" formatted in places which have null values.

At any rate, as always, thanks for your time!


Allen Browne said:
You can try:
=IIf(Len(Nz([PI], "")) = 0, "Need", Null)

However, I suspect something else is going on here, as the previous attempts
to identify what's what have been unfruitful.

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

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

NC_Sue said:
I don't see where it indicates either one - string or null.
Obviously I'm confused.
Probably I'm even confusing.

Perhaps the best thing is to give you an actual field name where I'm
trying
to do this - one of them is PI (the letters P & I, no spaces). How would
you
write this expression?

Thanks again - sorry to be a pest.


--
Thanks for your time!


Allen Browne said:
Ask Access what is in the field.

Make sure you have a text box on the report, with its Name and Control
Source both set to:
field_name_for_personnel_title

Beside that text box, place another one with Control Source of:
=TypeName([field_name_for_personnel_title].[Value])

Where the field_name_for_personnel_title field looks blank, is Access
telling you that it is a String or a Null?

When I try that, all results under that field name come up void - even
records that have personnel assigned. I also tried substituting the
field
name (in brackets) for Null @ the end of your expression and still came
up
void. Any ideas?
--
Again, thanks for your time!


:

Try:
=IIf(IsNull([field_name_for_personnel_title]),"Need", Null)


I have a bunch of tasks which need key personnel assigned... 4
personnel
with
different job titles for each task. I want to develop a report based
on
a
query which shows me when one or more of the "key players" for a
task
remains
unassigned. In my report, I want null fields to have the word "Need"
in
bold
face. How do I do this? Here's what I tried:

=IIf([field_name_for_personnel_title]="","Need","")
 
Back
Top