Howw do I embed a space character in an Access 2003 field?

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

Guest

I have multiple fields on a form. If I enter one or space character sinto a
field and save, the spaces are not saved. Field appears to be null. Any ideas?
 
If all you've entered are spaces it is null as far as Access is concerned!
Why do you want to save blanks spaces as a value?
 
Hi

I agree with MissingLink in that you "should" be able to - something like
Private Sub FieldName_AfterUpdate()
If Me.FieldName = " " Then
Me.FieldName = " " & Me.FieldName
End If
End Sub

But this will not work as you are entering a null.

Same question - why do you want to store a space ? Sound interesting



--
Buon Natale, Happy Chritmas.

Wayne
Manchester, England.
Scusate,ma il mio Inglese fa schiffo :-)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.
 
well, you can't store a "space" in a field, but you *can* store a
zero-length string, which is not the same thing as a Null value. you'd have
to set the field's AllowZeroLengthString property to Yes, at the table
level. but i wouldn't recommend it; in fact, it's generally recommended that
you set that property to NO in all Text, Memo and Hyperlink data-type
fields.

if you'll explain what you're trying to accomplish, quite possibly someone
in this newsgroup can suggest an alternate solution.

hth


wwwEngineers said:
I have multiple fields on a form. If I enter one or space character sinto a
field and save, the spaces are not saved. Field appears to be null. Any
ideas?
 
I wanted to concatenate the field with other fields and this was causing the
reuslt to be NULL using thr "+". I have since figured out that using "&"
saolves that problem.

Nonetheless, a space is valid character and I still don't undetrtand why I
cannot save one one more space in a column.
 
Nonetheless, a space is valid character and I still don't undetrtand why I
cannot save one one more space in a column.

Because Access truncates any trailing blanks from Text or Memo fields.

Storing "A" or "A " or "A " in a Text
field stores just the single letter A.

It makes a lot of sense: it's more than a bit difficult to distinguish

A
A
A
A
A

from one another, unless you use a Len() function or some
non-intuitive searches (e.g. LIKE "A *")


John W. Vinson[MVP]
 
Thanks John:

Question: Does MS SQL server also truncate trailing blanks?

Mark
 
Thanks John:

Question: Does MS SQL server also truncate trailing blanks?

Mark

Depends on the field type. You can use a Varchar type field (which
works like a JET Text field), or a Char(size) field, which is fixed
length. That is, a Char(50) field will take up 50 characters on disk
regardless of its contents, both in the table and in any indexes on
the table.


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top