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 / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

Special character in text column

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alan T - 09 Jan 2008 04:17 GMT
I have a column defined as text field in MS Access 2003.
I want to insert a string with prefixed of hex02, followed by Carriage
Return, followed by Line Feed and ended with hex03.

How do I do that manually?
eg.
(hex02 character)....This is a test.....(Carriage Return, Line Feed, hex03)

Thanks
Arvin Meyer [MVP] - 09 Jan 2008 04:37 GMT
Hex(2) & "....This is a test...." & vbCrLf & Hex(3)
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

>I have a column defined as text field in MS Access 2003.
> I want to insert a string with prefixed of hex02, followed by Carriage
[quoted text clipped - 6 lines]
>
> Thanks
Alan T - 09 Jan 2008 04:56 GMT
Sorry, I mean how do I manually enter the string with the special characters
by :
Run MS Access
Open the table in data view
Goto the record field
Enter it

> Hex(2) & "....This is a test...." & vbCrLf & Hex(3)
> >I have a column defined as text field in MS Access 2003.
[quoted text clipped - 7 lines]
> >
> > Thanks
John W. Vinson - 09 Jan 2008 05:17 GMT
>Sorry, I mean how do I manually enter the string with the special characters
>by :

Not sure it will work - those are not in the valid ASCII range - but try this:
hold down the Alt key and enter

002

or

003

on the numeric keypad. It might instead be necessary to just use 02 and 03.

            John W. Vinson [MVP]
Douglas J. Steele - 09 Jan 2008 11:53 GMT
>>Sorry, I mean how do I manually enter the string with the special
>>characters
[quoted text clipped - 12 lines]
> on the numeric keypad. It might instead be necessary to just use 02 and
> 03.

And sorry if I'm stating the obvious, but you must use the numeric keypad
(not the numbers at the top of the keyboard), and  NumLuck must be on.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

Casteele/ShadowLord - 09 Jan 2008 14:34 GMT
(Sorry if this posts twice.. Web based readers are PitA's!)

As far as I have ever experienced, you cannot directly enter any control
codes (ASCII codes 0-31 decimal / 0x00-0x1F hex (or &H00-&H1F for the VB
purists ;-))) directly from the keyboard, not even using the ALT+0nnn trick
on the numeric keyboard. Think of it like the ALT key on many keyboards; The
ALT key is a modifier key that changes how the keyboard operates _or_ how the
program interprets the following keystrokes. The control key and any control
codes it helps generate are much the same. The only real difference is that
when ASCII was first designed, the control codes were assigned a block of
ASCII codes so they could be transmitted over the data link to control the
recieving end. There was no intention at that time that such codes would ever
be *part* of the data stream, so there was little reason that teletypes,
computers, etc, needed to directly enter the codes. Sorry if I'm not being
very clear about that all, I'm trying not to give a long technical
explaination.. Just enough to understand why you cannot.

What you can do, however, is write some code (VBA can do it, not sure about
macros) which can either insert such codes directly as part of their
processing, or you can write a conversion routine and assign it to an
input/edit event (I'm not entirely sure how to do this in VBA, I only know it
_can_ be done.) Typically, you'd have such a routine scan through the string
and find special sequences, called "escape sequences", like "\x03" (many
programming and scripting language use such escape sequences for special
codes) and convert them into the proper bytes before storing it in your
database.

Alternatively, you can store the data "as-is" (meaning, if you type "\x03"
into the field, it's stored as the text string "\x03", not as the hex code
0x03) directly in the database, and do the conversion only when you extract
the data.

Each method has it's pro's and con's, and which is best depends on what you
plan to do with it.

HTH,
C.

> I have a column defined as text field in MS Access 2003.
> I want to insert a string with prefixed of hex02, followed by Carriage
[quoted text clipped - 5 lines]
>
> Thanks
John W. Vinson - 09 Jan 2008 17:50 GMT
>As far as I have ever experienced, you cannot directly enter any control
>codes (ASCII codes 0-31 decimal / 0x00-0x1F hex (or &H00-&H1F for the VB
>purists ;-))) directly from the keyboard, not even using the ALT+0nnn trick
>on the numeric keyboard.

Thanks, Casteele. After I posted (should have done it before!!!) I tried
several variants and it appears that you're right - you cannot enter x'02'
from the keyboard using that technique, or perhaps at all.

            John W. Vinson [MVP]
Alan T - 13 Jan 2008 23:08 GMT
Or I get around by this:
I have a sample file contains text strings have these Hex02 and Hex03
characters.
If I open this text file by a text editor like NotePad or UltraEdit. Then
Copy(Ctl+C) the text string and paste(Ctl+V) into the text column. Does MS
Access 2003 preserve these 2 characters?

> >As far as I have ever experienced, you cannot directly enter any control
> >codes (ASCII codes 0-31 decimal / 0x00-0x1F hex (or &H00-&H1F for the VB
[quoted text clipped - 6 lines]
>
>              John W. Vinson [MVP]
John W. Vinson - 14 Jan 2008 01:04 GMT
>Or I get around by this:
>I have a sample file contains text strings have these Hex02 and Hex03
>characters.
>If I open this text file by a text editor like NotePad or UltraEdit. Then
>Copy(Ctl+C) the text string and paste(Ctl+V) into the text column. Does MS
>Access 2003 preserve these 2 characters?

I don't know... let's try it...

x02:
x03:

Shows up as a rectangular box (in UltraEdit, Access and Agent); not sure what
you'll see there.

            John W. Vinson [MVP]
John W. Vinson - 14 Jan 2008 03:17 GMT
>>Or I get around by this:
>>I have a sample file contains text strings have these Hex02 and Hex03
[quoted text clipped - 10 lines]
>Shows up as a rectangular box (in UltraEdit, Access and Agent); not sure what
>you'll see there.

Curious. The journey from Agent to the newsgroup and back has changed the
x'02' to x'3A', a colon.

            John W. Vinson [MVP]
Alan T - 14 Jan 2008 05:34 GMT
To make it complicated.
How do I append Carriage Return character and Line Feed character at the end
of line?

> >>Or I get around by this:
> >>I have a sample file contains text strings have these Hex02 and Hex03
[quoted text clipped - 15 lines]
>
>              John W. Vinson [MVP]
John W. Vinson - 14 Jan 2008 05:53 GMT
>To make it complicated.
>How do I append Carriage Return character and Line Feed character at the end
>of line?

That's *really* easy. Ctrl-Enter; or set the textbox's Enter Key Behavior
property to New Line.

In code, append Chr(13) & Chr(10) or vbCrLf to the text.

Much easier than the nonstandard x'02' and x'03' characters!

            John W. Vinson [MVP]
Alan T - 14 Jan 2008 23:38 GMT
Hi,
I tried this in the very first beginning of my problem but it seemed did not
work.

eg. I entered Goodbye and Ctrl-Enter in the MSAccess table.

I copied the string to a text file and wrote a small application to read the
string out.
The application display character one by one, there were only 7 characters.

> >To make it complicated.
> >How do I append Carriage Return character and Line Feed character at the end
[quoted text clipped - 8 lines]
>
>              John W. Vinson [MVP]
John W. Vinson - 15 Jan 2008 06:01 GMT
>Hi,
>I tried this in the very first beginning of my problem but it seemed did not
[quoted text clipped - 5 lines]
>string out.
>The application display character one by one, there were only 7 characters.

VERY odd. Ok, I tried it in one of my tables, and of course you're right.

If you type Ctrl-Enter and then any printing character - not a blank it seems
- it gets trimmed off (just as a trailing blank will get trimmed off).

I was not aware of that.

            John W. Vinson [MVP]
 
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.