Jul 02 2020 05:48 AM
Jul 02 2020 05:48 AM
I want to generate an ISO20022-compatible QR Code in Word using data from an Access DB query via a MERGEBARCODE field. The data must contain CR/LF, but the MERGEBARCODE field seems to strip out CR/LF when I read the QR Code with a QR reader. The CR/LF are visible in the Access query. Would you know why this happens, and if there is a way of fixing it?
Jul 02 2020 10:07 AM
Just an educated guess here.
"The CR/LF are visible ..."
When you say they are visible, does that mean you can see the ASCII codes themselves, or just the effect of the line breaks in the displayed text?
My guess would be the latter, and that you might need to identify more precisely what those line break ASCII codes are so you can ensure the proper codes are used.
Jul 03 2020 01:48 AM
@George HepworthYes, the effect of the line breaks is visible in the data sheet view of the query, e g
CH65 3000 0001 4000 1784 9
GGG Basel Kurse / Geschäftsführung Basel
When I read the QR Code generated by the MERGEBARCODE field with a QR Reader, it shows the data all in one line, without the line breaks. However, when I copy that data and paste it into Word or Notepad, the line breaks appear again as they should. It is very strange.
The line breaks are important, because in ISO20022 they signal the end of a data field, and have to be present even if the data field is empty. When I test the QR code on the ISO20022 testing platform, it gets rejected because the number of fields is incorrect (presumably, it only sees one field when there should be about 30).
I generated the line breaks in the Access query using "Chr(13) & Chr(10)" (and also "Chr$(13) & Chr$(10)", but it made no difference). From the documentation, that seems to be the standard way of inserting line breaks. Do you have any other way?
Jul 03 2020 06:52 AM
@landste1 I think the problem is that the characters which create the line breaks are not visible to you but they are there. It may be that Access doesn't recognize whatever those line break characters are and therefore doesn't render them appropriately.
What I would do is try to parse the text string and figure out what they are.
Jul 04 2020 02:08 AM
@George HepworthI did indeed parse the string using an online ASCII converter and a unicode converter that reveal non-printing characters, and the CR/LF codes were there just as they should be. I suspect that the problem lies not with Access itself, but with the MERGEBARCODE field in Word which generates the QR code from the Access DB. That seems to alter the CR/LF in a minor way which disturbs some QR readers but which doesn't show up in ASCII and unicode converters that reveal non-printing characters. It looks like it is something buried deep in the function code, and in that case I shall have to find another solution that doesn't use Word fields.
Thanks anyway for your interest and suggestions, it was encouraging that you tried to help me.