How do I store a "Tab" character in Access table?

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

Guest

The table is used to define what kind of delimiter an input file is using and
this information is going to be used later on to read the file. In that case,
how do I setup the field so that the user can store a "tab" in there?
 
Access doesn't have any problem storing a tab character, it just can't
display it (unless you use a rich text control). You can easily provide a
command button that a user can click to store a tab character in a text
field ...

Private Sub Command8_Click()

Me.TestText = vbTab
Debug.Print "|" & Me.TestText & "|"

End Sub

vbTab is a VBA constant and can only be used in code. In queries or
expressions use Chr$(9) in place of vbTab.
 
What if I'm in the table view, if I just copy and paste a "tab" into the
field, would it be stored as a tab? If not, how can I enter in a "tab"
through the table view?

Thanks,
Simon
 
Apparently not. I just tried it, and Access removed the tab character as
soon as I moved to another record.

There are many things that can not be done using tables directly but can be
easily done using forms. Unless someone else knows differently, this would
appear to be one them.

What's your objection to using a form?
 
Heavens, if you want to store a delimiter character, for use somewhere,
store the numeric CHR$() value in a simple numeric variable; then you
can reconstruct the actual character through code, when you want.

It's asking for trouble to store control characters like tabs, returns,
linefeeds, and so on, directly within a database field.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 
No probs. It reminded me of a security system that I developed for a
Clipper (compiled DBase) system. If the user's password was "abc", for
example, the system actually stored "a<backspace>bc" (or somesuch) in
the passwirds table. If you looked in that table by using a seperate
copy of Dbase, the screen would display "bc" - not "abc", or
"a<splodge>bc". So you *thought* that you could steal the passwords
from the passwords table - but you actually couldn't, unless you knew
what I'd done :-)

Cheers,
TC (MVP Access)
http://tc2.atspace.com
 
Back
Top