I have a xml file that I import to access and I have two fields that are in the hex format. Is there away to convert those fields to text within access? I am thinking to do it after the import or should I do it on import?
Thanks,
Also thanks for all previous help, much appreciated.
10 18991
Hi, there.
Import hex number to a text field of a table (tbl.txtHex in the example). Run the following query: -
UPDATE tbl SET tbl.txtHex = Chr(Val("&H" & [txtHex]));
-
Regards,
Fish
P.S. Assumed you have two-digit hexadecimal number.
thanks i'll give it a try. I will post back success or failure.
it is a base 16 hexadecimal number i think. The field has 1024 characters. I guess that makes that query not work or am i missing something? If that query would still apply, then i get the error that it is not updatable.
it is a base 16 hexadecimal number i think. The field has 1024 characters. I guess that makes that query not work or am i missing something? If that query would still apply, then i get the error that it is not updatable.
More details would be nice.
So, you mean hexadecimal number with more than 2 hexadecimal digits (this means more than 1 ASCII character). So far so good.
Have you import the data to an Access table? What is the type of field in the table where this hexadecimal number is stored?
thanks FishVal. I do have the data in an access table, and the column name is called RemoteData with a data type memo(used memo because on importing the xml file, the RemoteData node had 1024 characters or less).
Here is a sample of my data in one of the fields: - 485454502f312e3120323030204f4b0d0a446174653a205475652c2031382044656320323030372031323a35323a323320474d540d0a5365727665723a204170616368652f322e302e3532202843656e744f53290d0a4c6173742d4d6f6469666965643a204672692c203138204d61722032303035
Which using an online converter should be converted to: - HTTP/1.1 200 OK
-
-
Date: Tue, 18 Dec 2007 12:52:23 GMT
-
-
Server: Apache/2.0.52 (CentOS)
-
-
Last-Modified: Fri, 18 Mar 2005
Anything else should I provide?
Quite enough. Try this. -
Public Function Hex2ASCII(strInput As Variant) As Variant
-
-
'if field is null then exit function
-
If IsNull(strInput) Then Exit Function
-
'make number of digits even
-
If Len(strInput) / 2 <> Int(Len(strInput) / 2) Then strInput = "0" & strInput
-
'convert hex codes to ASCII
-
For i = 1 To Len(strInput) Step 2
-
Hex2ASCII = Hex2ASCII & Chr(Val("&H" & Mid(strInput, i, 2)))
-
Next i
-
-
End Function
-
-
UPDATE tbl SET tbl.txtHex = Hex2ASCII([txtHex]);
-
I have a xml file that I import to access and I have two fields that are in the hex format. Is there away to convert those fields to text within access? I am thinking to do it after the import or should I do it on import?
Thanks,
Also thanks for all previous help, much appreciated.
I followed in FishVal's footsteps but only took a different approach. I Delimited the String by the Carriage Return/Line Feed Characters (0d0a in Hex), then used the Split() Function to populate a Variant Array which would then consist of each sentence (terminated by 0d0a). I then used FishVal's code to convert each Byte. The code and subsequent Output are listed below. If you have any problem implementing this approach, let us know: -
Dim strHex As String, varHex As Variant, intCounter As Integer
-
Dim T, strString As String
-
-
strHex = "485454502f312e3120323030204f4b0d0a446174653a205475" & _
-
"652c2031382044656320323030372031323a35323a323320474" & _
-
"d540d0a5365727665723a204170616368652f322e302e3532202" & _
-
"843656e744f53290d0a4c6173742d4d6f6469666965643a2046" & _
-
"72692c203138204d61722032303035"
-
-
varHex = Split(strHex, "0d0a")
-
-
For intCounter = LBound(varHex) To UBound(varHex)
-
For T = 1 To Len(varHex(intCounter)) Step 2
-
strString = strString & Chr$(Val("&H" & Mid$(varHex(intCounter), T, 2)))
-
Next
-
Debug.Print strString
-
strString = "" 'Reset String
-
Next
OUTPUT: -
HTTP/1.1 200 OK
-
Date: Tue, 18 Dec 2007 12:52:23 GMT
-
Server: Apache/2.0.52 (CentOS)
-
Last-Modified: Fri, 18 Mar 2005
P.S. - FishVal, Hope you didn't mind the intrusion, just found this problem interesting. If I stepped on your toes, I do apologize.
P.S. - FishVal, Hope you didn't mind the intrusion, just found this problem interesting. If I stepped on your toes, I do apologize.
Hello, ADezii.
Apologies not needed. I appreciate every comment concerning my posts.
FishVal and ADezii thank you so much. I greatly appreciate it.
FishVal I got yours to work flawless and fast. ADezii I kept getting a compile error: invalid outside procedure. I haven't had time to look into it, but it hopefully i can figure it out.
Thanks once again.
FishVal and ADezii thank you so much. I greatly appreciate it.
FishVal I got yours to work flawless and fast. ADezii I kept getting a compile error: invalid outside procedure. I haven't had time to look into it, but it hopefully i can figure it out.
Thanks once again.
Very interesting, I had no problem running this code in Access 2000 and 2003. If you find out what the problem is, please let me know. In any event, I'm glad you got FishVal's code to work flawlessly. Glad we were able to assist you, I'm not speaking for FishVal, but I'm sure he will feel the same way also. See you around.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Timothy Rue |
last post by:
I found the online and free PHP manual(s) but what I need is one that is
plain text/ascii
Is there such a beast and if not what is the closest to it?
I'd like to do my own markup on it.
...
|
by: Albert Tu |
last post by:
Hi,
I am learning and pretty new to Python and I hope your guys can give me
a quick start.
I have an about 1G-byte binary file from a flat panel x-ray detector; I
know at the beggining there...
|
by: Alison |
last post by:
I have data in an oracle9i database that is in RTF format and I need
to convert it to text format..
I have not found a way to do it with SQL or PL/SQL. Is there a tool
that can access the db an...
|
by: Calvin Lai |
last post by:
If my data in SQL server was stored from a web application with
requestEncoding set as iso8859-1. And now I want to change the data encoding
to big5, (or anything else), how could I do that? Thanks...
|
by: Knut-Olav Traa |
last post by:
Hello,
I need a component that transfers html strings to text format. The
component must format the text nice, and not just strip off the
html-tags. For example: The tabledata should be formated...
|
by: sandeep Naredla via .NET 247 |
last post by:
(Type your message here)
I need a code for extracting Text from PDF files without having to use any third party tools in C#.Although there are many free API's in Java available i need one for...
|
by: Benjamin Bécar |
last post by:
Hello everyone.
I have to find a correct architecture to achieve this XML <=Text
conversion platform. The platform (based on Win2003Server) will have to
deal with 21 million XML files and 16...
|
by: =?Utf-8?B?Um9zaGFuIFIuRA==?= |
last post by:
Hi All,
I am new to C# programming; I am developing an application for recording
audio data using voice modem.
I am using HyperTerminal to manually process audio data. The modem when
configured...
|
by: shwetamodi |
last post by:
I have find this code of converting numeric to text but it displays wrong result for 1000000 ten lakh and for all lakh values. Can anybody help me to correct this code.
<%
ss =...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |