A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Returning null values



 
 
Thread Tools Display Modes
  #1  
Old November 23rd, 2009, 04:24 AM posted to microsoft.public.access.queries
Joseph Greenberg
external usenet poster
 
Posts: 57
Default Returning null values

I have a report where I think that certain fields are not shrinking because
while I think that the associated query fields look blank, they are no in
fact null. How can I ensure that a query field (that is the result of an
expression) is in fact null, and not just blank?


  #2  
Old November 23rd, 2009, 05:43 AM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Returning null values

Joseph Greenberg wrote:

I have a report where I think that certain fields are not shrinking because
while I think that the associated query fields look blank, they are no in
fact null. How can I ensure that a query field (that is the result of an
expression) is in fact null, and not just blank?


What is the query field's expression?

If worse comes to worst, you can use a text box expression
in the report:
=Trim(Nz(thefield,""))
That will result in a zero length string (ZLS) if the field
contains only spaces, is Null or a ZLS. A report text box
will shrink if its value is Null, a ZLS or if the text box
is invisible.

--
Marsh
MVP [MS Access]
  #3  
Old November 23rd, 2009, 10:53 PM posted to microsoft.public.access.queries
Joseph Greenberg
external usenet poster
 
Posts: 57
Default Returning null values

I put the Trim(NZ code around my text box on my report and it is still not
shrinking. The query that builds the report is calling another query, which
is populating the field as "PrefEmailMem1:
LCase([PreferredEmail])".PreferredEmail is a field in my memberdetail table
of 50 characters, where I have to allow zero length (not everyone has email
).

Bottom line is that it is still not shrinking.

"Marshall Barton" wrote in message
...
Joseph Greenberg wrote:

I have a report where I think that certain fields are not shrinking
because
while I think that the associated query fields look blank, they are no in
fact null. How can I ensure that a query field (that is the result of an
expression) is in fact null, and not just blank?


What is the query field's expression?

If worse comes to worst, you can use a text box expression
in the report:
=Trim(Nz(thefield,""))
That will result in a zero length string (ZLS) if the field
contains only spaces, is Null or a ZLS. A report text box
will shrink if its value is Null, a ZLS or if the text box
is invisible.

--
Marsh
MVP [MS Access]



  #4  
Old November 24th, 2009, 03:05 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Returning null values

Try using the following expression in the query. It should force a null value
to be returned when PreferredEmail consists of a null, a zero-length string,
or multiple space characters.

PrefEmailMem1: IIF(Len(Trim(PreferredEmail & ""))0
,LCase([PreferredEmail])
,NULL)

If that does not work, then I would suspect that the problem lies not in the
data but in something you are doing in the report.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Joseph Greenberg wrote:
I put the Trim(NZ code around my text box on my report and it is still not
shrinking. The query that builds the report is calling another query, which
is populating the field as "PrefEmailMem1:
LCase([PreferredEmail])".PreferredEmail is a field in my memberdetail table
of 50 characters, where I have to allow zero length (not everyone has email
).

Bottom line is that it is still not shrinking.

"Marshall Barton" wrote in message
...
Joseph Greenberg wrote:

I have a report where I think that certain fields are not shrinking
because
while I think that the associated query fields look blank, they are no in
fact null. How can I ensure that a query field (that is the result of an
expression) is in fact null, and not just blank?

What is the query field's expression?

If worse comes to worst, you can use a text box expression
in the report:
=Trim(Nz(thefield,""))
That will result in a zero length string (ZLS) if the field
contains only spaces, is Null or a ZLS. A report text box
will shrink if its value is Null, a ZLS or if the text box
is invisible.

--
Marsh
MVP [MS Access]



  #5  
Old December 1st, 2009, 07:04 AM posted to microsoft.public.access.queries
Joseph Greenberg
external usenet poster
 
Posts: 57
Default Returning null values

I believe it was the report in the end - thanks for the help - it is working
now.

"John Spencer" wrote in message
...
Try using the following expression in the query. It should force a null
value to be returned when PreferredEmail consists of a null, a zero-length
string, or multiple space characters.

PrefEmailMem1: IIF(Len(Trim(PreferredEmail & ""))0
,LCase([PreferredEmail])
,NULL)

If that does not work, then I would suspect that the problem lies not in
the data but in something you are doing in the report.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Joseph Greenberg wrote:
I put the Trim(NZ code around my text box on my report and it is still
not shrinking. The query that builds the report is calling another query,
which is populating the field as "PrefEmailMem1:
LCase([PreferredEmail])".PreferredEmail is a field in my memberdetail
table of 50 characters, where I have to allow zero length (not everyone
has email ).

Bottom line is that it is still not shrinking.

"Marshall Barton" wrote in message
...
Joseph Greenberg wrote:

I have a report where I think that certain fields are not shrinking
because
while I think that the associated query fields look blank, they are no
in
fact null. How can I ensure that a query field (that is the result of
an
expression) is in fact null, and not just blank?

What is the query field's expression?

If worse comes to worst, you can use a text box expression
in the report:
=Trim(Nz(thefield,""))
That will result in a zero length string (ZLS) if the field
contains only spaces, is Null or a ZLS. A report text box
will shrink if its value is Null, a ZLS or if the text box
is invisible.

--
Marsh
MVP [MS Access]



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:38 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.