R
Robert5833
Good day all;
Windows Vista for Business / Access 2007
This is a follow-on issue to a previous post where I was looking for and was
provided with a solution for text string parsing and formatting. (Thank you
Jerry Whittle and John Spencer!)
I am trying to manipulate a string of data from a barcode scanner, which
will then be appended to a table. The RS232 device is using a wedge
interface. The string to be manipulated is Text.
So far what I have works well in most instances, but there are still two
cases that I need help with; *variable length strings* and *strings
containing ASCII type characters*.
One example *but not the only one* is the variable length string issue as a
result of formatted dates not being of a fixed length; e.g., 1/1/09, vs.
11/11/09.
Here’s the raw string from the barcode scanner:
090728100223*DeviceID001*1110%7%20%2009*RRL
I need a method to measure the length of the string, and add a leading “0â€
if needed, to result in a final string of 01/01/09 to match what would be the
maximum length string, of say 10/10/09.
The second issue, ASCII type characters, results from dates which I collect
using a barcode. The VB conversion of 7/20/2009 to a Code 39 barcode is
returned by the barcode scanner as %7%20%2009.
For this I need a method to replace the “%†character with the “/†character
in the returned text string.
With the help of this group on similar topics, I am able to parse the date
(text string), replace the “%†with the “/†character, and then concatenate
the results, but I would like to do that with a single method.
Here’s what I have now:
Rplc_%_1: Replace(Mid([F1],31,2),"%","/")
Rplc_%_2: Replace(Mid([F1],33,3),"%","/")
Rplc_%_3: Mid([F1],36,4)
DateConc: [rplc_%_1] & "" & [rplc_%_2] & "" & [rplc_%_3]
I have tried unsuccessfully to group the three replace methods into a single
string, but kept getting the “Wrong number of arguments†error.
Note; as I write this post I see that in order to add a leading “0†to the
“day†portion of the string, I may have to parse the string into its
constituent parts anyway.
The barcode scanner does have a timestamp (always 6 characters; 010109,
etc.), which is useful, and thanks to the help I have received from this
group I am able to format that information into the proper data type. For
that I am using the following:
TrueP_Date: CDate(Format(Mid([F1],1,6),"""20""@@\/@@\/@@"))
But there are other instances where I need to scan an actual date.
Any advice (a better or more conventional approach) or examples (SQL or VBA)
would be greatly appreciated, and thank you in advance for your help.
Robert
Windows Vista for Business / Access 2007
This is a follow-on issue to a previous post where I was looking for and was
provided with a solution for text string parsing and formatting. (Thank you
Jerry Whittle and John Spencer!)
I am trying to manipulate a string of data from a barcode scanner, which
will then be appended to a table. The RS232 device is using a wedge
interface. The string to be manipulated is Text.
So far what I have works well in most instances, but there are still two
cases that I need help with; *variable length strings* and *strings
containing ASCII type characters*.
One example *but not the only one* is the variable length string issue as a
result of formatted dates not being of a fixed length; e.g., 1/1/09, vs.
11/11/09.
Here’s the raw string from the barcode scanner:
090728100223*DeviceID001*1110%7%20%2009*RRL
I need a method to measure the length of the string, and add a leading “0â€
if needed, to result in a final string of 01/01/09 to match what would be the
maximum length string, of say 10/10/09.
The second issue, ASCII type characters, results from dates which I collect
using a barcode. The VB conversion of 7/20/2009 to a Code 39 barcode is
returned by the barcode scanner as %7%20%2009.
For this I need a method to replace the “%†character with the “/†character
in the returned text string.
With the help of this group on similar topics, I am able to parse the date
(text string), replace the “%†with the “/†character, and then concatenate
the results, but I would like to do that with a single method.
Here’s what I have now:
Rplc_%_1: Replace(Mid([F1],31,2),"%","/")
Rplc_%_2: Replace(Mid([F1],33,3),"%","/")
Rplc_%_3: Mid([F1],36,4)
DateConc: [rplc_%_1] & "" & [rplc_%_2] & "" & [rplc_%_3]
I have tried unsuccessfully to group the three replace methods into a single
string, but kept getting the “Wrong number of arguments†error.
Note; as I write this post I see that in order to add a leading “0†to the
“day†portion of the string, I may have to parse the string into its
constituent parts anyway.
The barcode scanner does have a timestamp (always 6 characters; 010109,
etc.), which is useful, and thanks to the help I have received from this
group I am able to format that information into the proper data type. For
that I am using the following:
TrueP_Date: CDate(Format(Mid([F1],1,6),"""20""@@\/@@\/@@"))
But there are other instances where I need to scan an actual date.
Any advice (a better or more conventional approach) or examples (SQL or VBA)
would be greatly appreciated, and thank you in advance for your help.
Robert