2021-02-09: Fixed some irritating bug in the form design, added button to save record
2021-12-06: Limited URL lenght in form to 62 characters which seems to be the maximum. Removed references to MriLib.
You still have that QR/JavaScript extension installed.
If you are still using OpenOffice, install the report builder extension. I'd prefer
https://libreoffice.org/ where this thing is built-in.
menu:Tools>Options... Security, [Macro Security...], set highest level and add a trusted directory for documents with embedded macro code. Do NOT use your Downloads folder. Your Documents folder is a better place.
Save the attached document to that directory or any subdirectory therein.
Create a subdirectory "qr" in the directory where you saved the document.
Open the document and the form therein.
Push the big button. It triggers an embedded macro which itself calls the extension macro which itself calls the JavaScript that produces QR codes.
Navigate the form records and try the codes with your smart phone.
Open the report.
A report is something printable, a form is for interactive data input, filtering, sorting, viewing.
--------------------------------------------------------------------------------------------------------------------------
How it works:
The form, the report and the macro rely on a query named "QR". The query must have a text column "URL" to generate the pictures from and a column "FN" of unique file names.
Query "QR" in the attached document goes like this:
Code: Select all
SELECT "TXT" AS "URL",
"PK" AS "ID",
'qr/' || RIGHT( '000000' || "PK", 7 ) || '.svg' AS "FN"
FROM "Table1"
I have a table "Table1" from where I select the column "TXT" renamed to "URL", a unique primary key "PK" renamed to "ID" and a concatenation of subdirectory 'qr/' with an expression that creates a 7-digit number from the unique primary key plus the '.svg' file name suffix. The concatenation of the unique file names in subdirectory "qr" is named "FN".
The order of columns does not matter, the order of rows does not matter. All that matters is that some query "QR" has a column "URL" and a column "FN".
The macro loops through all records of that query and writes the QR code for "URL" into the file specified by "FN" by simply calling the code you already have installed.
The image controls in both elements, the form and the report, are linked to the "URL" column of the "QR" query which point to a relative file URL. The database document has no images stored.
P.S. any filtering applied to the form will affect the count of generated QR codes. Only visible form records get a new QR.
P.P.S. menu:Tools>Macros>Organize>Basic... tab "Libraries" allows to import the QR library from my document into yours if both documents are loaded. Create your own "QR" query in your database and that's it.