Solved

Check if all characters are spaces- Access 2003

Posted on 2013-01-29
5
308 Views
Last Modified: 2013-02-04
I have a program that brings in data from another system.  However, if ther eis nothing in the field, rather than brining in null, it seems to populate with a lot of spaces - how can I check to see if all characters in a field a simply spaces and set the field to null?

Sandra
0
Comment
Question by:ssmith94015
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38833356
try this query

select [fieldName], len([fieldName])
from tableName
where len([fieldName]) >0

check the resulting query..

maybe they are not spaces, but some unprintable characters like tab, CR, LF

to set the fields to Null, use an update query, but you need to find out first what those unprintable characters
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 38833406
Try trim(fieldName)
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 38834391
Use this expression:

IIf(Len(Trim([YourPerhapsEmptyField])) = 0, Null, Trim([YourPerhapsEmptyField]))

/gustav
0
 

Author Closing Comment

by:ssmith94015
ID: 38851766
This worked as I really did need to check to see if it was 0 length as some were and some had spaces in both front and at the end of the imported string.

Sandra
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 38852126
Great!

/gustav
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question