Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / December 2005

Tip: Looking for answers? Try searching our database.

TRIM Function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob - 30 Nov 2005 21:46 GMT
I am having a problem in querying what records have null value in a table. I
know there are 80 Null out of 100 rec.
In a query I say, Where Name is Null, I get 60 null rec. If I try Where Name
is "", I get 70 rec.
1. Why am I not receiving the other 10 records?
2. If I run TRIM function will it help? If yes how can I write the query
using TRIM?
Signature

Thank you
Bob

OfficeDev18 - 30 Nov 2005 22:15 GMT
The Nz() function fits beautifully here. To query for no-value, your query
would look like:

SELECT * FROM YourTable WHERE Nz(SomeField," ")=" "

If the possibly-null field is numeric or date, you must make a tweak as
follows:

SELECT * FROM YourTable WHERE Nz(SomeField,0)=0

See the Nz() function in the Help for details. This will return all records
where SomeField is null, equals "", or equals " ".

HTH

>I am having a problem in querying what records have null value in a table. I
>know there are 80 Null out of 100 rec.
[quoted text clipped - 3 lines]
>2. If I run TRIM function will it help? If yes how can I write the query
>using TRIM?

Signature

Sam

George Nicholson - 30 Nov 2005 22:30 GMT
Null and an empty string (aka "" are not the same thing. A space (aka " ")
is something else again.

Try: Where trim(nz([Name],"")) = ""  or (my preference) Where
Len(trim(nz([Name],""))) = 0

The nz (null-to-zero) function will cause Null values to be evaluated as if
they were "".
Similarly, the trim function will cause any " " entries to evaluate as "".

(Using Len or Trim on [Name] will generate an error if Name is Null unless
you use nz() first.)

HTH
Signature

George Nicholson

Remove 'Junk' from return address.

>I am having a problem in querying what records have null value in a table.
>I
[quoted text clipped - 5 lines]
> 2. If I run TRIM function will it help? If yes how can I write the query
> using TRIM?
Gary Walter - 01 Dec 2005 13:25 GMT
PMFBI

my favorite test for "blank" field:

Len(Trim([somefield] & "")) = 0

Apologies again,

gary

> Null and an empty string (aka "" are not the same thing. A space (aka " ")
> is something else again.
[quoted text clipped - 19 lines]
>> 2. If I run TRIM function will it help? If yes how can I write the query
>> using TRIM?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.