How to dump a table into an msdos text file

  • Thread starter Thread starter Ruby Tuesday
  • Start date Start date
R

Ruby Tuesday

Hi, I'm having problem moving my Access record to mysql because in Access I
have special characters such as fraction(1/4, 1/2,...) and other such as
backquote(`), etc...

How do I dump it so it replace the fraction with ASCII character
replacements and others but if there are no equivalent, ignore them.

How do you do it programatically in VBA Access XP?

Thanks
 
Ruby Tuesday said:
Hi, I'm having problem moving my Access record to mysql because in
Access I have special characters such as fraction(1/4, 1/2,...) and
other such as backquote(`), etc...

How do I dump it so it replace the fraction with ASCII character
replacements and others but if there are no equivalent, ignore them.

How do you do it programatically in VBA Access XP?

Thanks

You could write a function to translate those characters in whatever
text or memo field is passed to it, using the Replace() function to do
the actual translation. For example:

'----- start of code (AIR CODE) -----
Public Function XlateASCII(FieldText As Variant) As Variant

Dim strText As String

If Len(FieldText & vbNullString) = 0 Then
XlateASCII = FieldText
Else

' Replace the '½' (one-half) character
strText = Replace(FieldText, Chr(189), "-1/2", , ,
vbBinaryCompare )

' Replace the '¼' (one-quarter) character
strText = Replace(strText, Chr(188), "-1/4", , ,
vbBinaryCompare )

' Replace the '¾' (three-quarters) character
strText = Replace(strText, Chr(190), "-3/4", , ,
vbBinaryCompare )

' Replace the '`' (back-quote) character
strText = Replace(strText, Chr(96), "'", , , vbBinaryCompare )

' ... other replacements ...

XlateASCII = strText
End If

End Function
'----- end of code -----

Then, instead of exporting your table, you could export a query in which
you use the XlateASCII function where necessary to translate text and
memo fields.
 
I remember when I convert a Word table into text, it has an option to do
character subtitution. So it does convert any non-ascii such as fraction,
etc into and ascii representation such as 1/4, 1/2, 5/8 ....etc.

Does MS Access has that option?

I have no idea what other character beside fractions and backquote but is
there a table for a list of translate-able characters to its text
equivalents so I do not have to explicitly find out what non-ascii character
need the text substitution.

Thanks.
 
Ruby Tuesdays said:
I remember when I convert a Word table into text, it has an option to
do character subtitution. So it does convert any non-ascii such as
fraction, etc into and ascii representation such as 1/4, 1/2, 5/8
....etc.

Does MS Access has that option?

Not that I know of. Maybe you could export your table to Word, and then
open the exported file in Word and get Word to convert it for you.
I have no idea what other character beside fractions and backquote
but is there a table for a list of translate-able characters to its
text equivalents so I do not have to explicitly find out what
non-ascii character need the text substitution.

I don't know of any such table. I note that the back-quote actually
*is* an ASCII character, so if you feel you need to convert it you have
to be more specific about which characters you need to convert. As for
high-order ASCII characters, that is, characters with decimal values in
the 128-255 range, you could possibly write a little routine to scan
through all the data you have and see which ones actually occur, make
that into a table and decide how you want to translate each one.
 
Dirk, thank you.

The character I have problem with is fractions(1/4, 1/2, 3/4,1/8, 3/8, 5/8)
and international character with either a backtick on top of e or a single
quote on top of e(I guess its french).

How do you find out if the character is beyond the regular ASCII table? And
how to convert it so the text can display them.

I'm planning to put them back into the database for searching and display
them on the browser.

Thanks
 
NOTE: In your reply, please trim the newsgroups to only
microsoft.public.access.modulesdaovba, since that's the only one that
seems relevant.

Further comments inline ...

Ruby Tuesday said:
The character I have problem with is fractions(1/4, 1/2, 3/4,1/8,
3/8, 5/8) and international character with either a backtick on top
of e or a single quote on top of e(I guess its french).

I'm not aware of the 1/8, 3/8, 5/8 characters. What font are you using?
I think the other characters you describe are accented characters.
How do you find out if the character is beyond the regular ASCII
table? And how to convert it so the text can display them.

It seems that your problem is that these characters are beyond the
values ASCII values 0-127, which are pretty much standardized. To
identfy them in a string, you can use the ASC() function to check the
ASCII value of each character to see if it's over 127. For example, the
following little code procedure will display (in the Immediate Window) a
list of all such characters in a given string, and how many times they
occur.

'---- start of "air code" -----
Sub ListNonstandardCharacters(ArgText As String)

Dim alngChars(128 To 255) As Long
Dim lngI As Long
Dim intAsc As Integer

For lngI = 1 to Len(ArgText)
intAsc = Asc(Mid$(ArgText, lngI, 1))
If intAsc > 127 Then
alngChars(intAsc) = alngChars(intAsc) + 1
End If
Next lngI

For intAsc = 128 to 255
If alngChars(intAsc) > 0 Then
Debug.Print _
"Char " & Chr(intAsc) & ", ASCII " & intAsc & _
", occurs " & alngChars(intAsc) & " times"
End If
Next intAsc

End Sub
'---- end of "air code" -----
 
Back
Top