Link to home
Start Free TrialLog in
Avatar of dzirkelb
dzirkelbFlag for United States of America

asked on

Produce HEX and ASCII in query results or in a visual basic variable

We have a need to produce hex and ascii in the same results field.

The field with data will be bound to a 2D barcode (the square ones you see everywhere now). The format of the data is to look like this:

[)><RS>06<GS>xyz<RS><EOT>

The <RS>, <GS>, and <EOT> all need to be hex values as follows:

<RS> = Hex 1E, Decimal 30
<GS> = Hex 1D, Decimal 29
<EOT> = Hex 04, Decimal 04

When I run my Access query as follows:

BarCode: "[)>"&Hex(30)&"06"&Hex(29)&"xyz"&Hex(30)&""&Hex(04)& ""

It produces the following:

[)>1E061Dxyz1E04

So, it just converts it to ASCII; however, when I go to scan it, it actually reads that information also. I need the 1E, 1D, and 04 to actually be scanned as HEX for the validation to occur for our client.

Is it possible using an Access query to return these desired results? If not, I will have to look atother piece of software to produce the bar code labels.
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

So to be clear, you have this:
[)><RS>06<GS>xyz<RS><EOT>

..and you want this?:
[)><1E>06<1D>xyz<1E><04>
Avatar of dzirkelb

ASKER

Part of the problem is the explanation.

Where it says <rs>, or <1E>, they are the same thing, description of what is needed for hex.  I don't want to show a hex value in ASCII format, hence the 1E, I want it to actually be a hex value, not a hex value converted to string.

So, it won't actually show the <rs> or the <1E> in a program because hex isn't rendered visible / readable, it is simply translated by the machine seeing it.
Then I am not sure that this can be done easily in Access.

I know there are ways to store BLOB ((B)inary (L)arge (O)(B)ject) data in Access, but not sure if this would include pure HEX.

So lets see what other experts may post...
I am leaning towards agreeing with you, and ya, a solution is to export it to a text file with binary embedded with the regular string, then link it to a database field, then query that, but meh, no thanks :)
hex isn't rendered visible / readable
Is this similar to a UPS Maxicode barcode?  If so, then I believe you mean that these are non-printable ASCII characters.  
Try this:
BarCode: "[)>" & Chr(30) & "06" & Chr(29) & "xyz" & Chr(30) &"" & Chr(04)
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No luck, we are just purchasing new software that does it easier, thanks for the suggestions.