Access – QR Code Generator

Access - QR Code Generator

I saw a question in a forum which made me want to play around with QR Codes in Access.

I’ve seen QR Code ActiveX controls for sale, solutions that use Excel and copy the generated code from there, … but I wanted something that could simply be integrated easily within Access (or any other application for that matter) that didn’t involve installing things, paying money, interacting with outside applications…  So a simple standalone solution.

How hard could it be?!

I knew that there existed a few javascript (js) QR Code libraries, no point reinventing the wheel! so I did a quick Google search and found a simple js library that had no dependencies (bonus!):

with this in hand, it was just a question of using the knowledge found on my WebBrowser control article:

to put it all together in a WebBrowser control within a form.

The Access QR Code Generator

Within an hour or two I had a simple and effective solution that  illustrates how one can effectively integrate the technology within any Access database application.

Access - QR Code Generator - 02

Access - QR Code Generator - 01This actually requires little VBA code to achieve (best of all no APIs whatsoever) and thus works on both 32-bit and 64-bit office installations.

In the latest version, I now have included the necessary code to take the QR Code generated in the WebBrowser control (HTML) and save it locally as a file (automatically upon generation) so it can then easily be printed, included in Access reporting (since Access reports don’t support the WebBrowser control), used in external applications if required, etc…

Now, I used one of many js QR Code libraries available online, but you could just as easily swap it out for another.  However, this one is standalone (no internet required) and has no dependencies making it ideal IMHO.

This is simply a proof of concept demo to try and help a few of you out there.  That said, with this in hand, I can now implement QR Code generation into any Microsoft Access database in 2-5 minutes.  How good is that!

I hope this proves useful to some.

Requirement(s)
Be aware that this demo requires that Feature Browser Emulation de setup and set to a minimum of IE9. Then again, if you’re setting up Feature Browser Emulation, set it to emulate the most recent version! You can get all the details by reviewing:
 

Disclaimer/Notes:

If you do not have Microsoft Access, simply download and install the freely available runtime version (this permits running MS Access databases, but not modifying their design):

Microsoft Access 2010 Runtime
Microsoft Access 2013 Runtime
Microsoft Access 2016 Runtime
Microsoft 365 Access Runtime

All code samples, download samples, links, ... on this site are provided 'AS IS'.

In no event will Devhut.net or CARDA Consultants Inc. be liable to the client/end-user or any third party for any damages, including any lost profits, lost savings or other incidental, consequential or special damages arising out of the operation of or inability to operate the software which CARDA Consultants Inc. has provided, even if CARDA Consultants Inc. has been advised of the possibility of such damages.

Download a Demo Database

Feel free to download a 100% unlocked demo copy by using the link provided below:

Download “Access - QR Code Generator” MSAccess_QRCodes.zip – Downloaded 14935 times – 123.34 KB

Version History

Version Date Changes
V1.000 2022-09-06 Initial Release
V1.001 2022-09-06 Added local saving of generated QR Code for printing, report generation, … and added a report to show how it could be linked to the locally saved QR Codes for reporting purposes.

Other JS QR Code Libraries

Here are a few other JS libraries that might be worth investigating further should you not like the one I implemented in the demo file:

28 responses on “Access – QR Code Generator

  1. Robert Simard

    Merci, très intéressant Daniel !
    On peut sortir un programmeur du VBA mais le VBA reste en lui a jamais !

  2. Jonanthan Harrison

    Very impressive!

    I’m actually in need of this functionality for a project I am working on. This is great timing. Thank you, thank you, thank you.

  3. Jaffer Almoosawi

    Hi Daniel
    I use zint barcode generator: https://sourceforge.net/projects/zint/
    And here I put it together with MS Access (its in Arabic, but go for the code) : https://www.officena.net/ib/topic/90906-%D9%83%D8%A7%D8%B1%D9%86%D9%8A%D9%87%D8%A7%D8%AA-%D8%A8%D8%A7%D8%B3%D8%AA%D8%AE%D8%AF%D8%A7%D9%85-%D8%A8%D8%A7%D8%B1%D9%83%D9%88%D8%AF-%D9%85%D8%A7%D8%AA%D8%B1%D9%83%D8%B3-qr-code/

    With zint, I can output any type of barcode/QR directly to an image.

    jaffer

    1. Daniel Pineault Post author

      Very impressive and thank you for sharing.

      So you’re sending the command to an external app and then retrieving the result (an image). This is a great option for those that are allowed to install software on their PCs.

      Is there a sample that people can download?

  4. Jaffer Almoosawi

    Thank you Daniel
    Zint is portable, so no need for installation, fully driven with command line, and works on almost all kinds of 1D/2D Barcodes.
    There is a fully working sample in the link in my earlier post.

    jaffer

    1. Daniel Pineault Post author

      I’ll try using Google translate and see if I can find it.

      I use the term installation, but it goes beyond that. In most corporate environments you can’t even use portable app, they lock things down for security reasons. This is a great option for those that don’t have such limitations and why I want to get your demo to look over.

  5. Pierre-sté

    bonjour Daniel,

    bravo pour cette formule de generateur de QR code sur access.
    je connais bien access, par contre pas grand chose sur javascript.
    après avoir cliqué sur le lien de Github, je ne comprends plus…
    que dois je installer et ou l’installer?
    merci pour votre aide.
    cordialement.

      1. Muscat PS

        bonjour Daniel,
        merci pour votre réponse.
        j’ai copié les fichiers; l’appli génére bien le QR code pour chaque contact.
        par contre les QR code générés ne s’enregistrent pas dans le folder “QRcodes”.
        il y a un script error à chaque changement de contact:
        “unable de get property ‘src’ of undefined or null reference”
        error number: -2147352319
        could not complete the operation due to error 80020101
        Line No: 140
        merci pour votre aide.
        cordialement.

      2. Didier

        Merci Daniel, c’est vraiment très intéressant et cela fonctionne bien.
        Mais j’ai un problème car je dois générer un Swiss-QRCode pour les paiements en suisse, et il y a des retours à la ligne ainsi que des caractères accentués. Il me semble que le code JS utilisé ne permet pas ces caractères ?!
        Y a-t-il une solution ?
        Cordialement
        Didier

  6. Fayzul Munir

    I have been using the Quricol dll file for the past few years. Recently I’ve got another sample which pure integrated with MS Access. It’s completely standalone solution. You don’t need to use any third party software or don’t need to save QR code as a image. You can check it from the following link:

    https://zingl.github.io

    Hope you will compare both of these solutions and give a feedback which one is better to use.

    1. juan pablo gayoso

      Hi Ayzul
      I really interested to implement the Access solution in my project. Do you know some examples (tutorial), that I can use as guide? I have a Access database, and would need to add the QR function….thank you so much

      1. Daniel Pineault Post author

        Did you try the demo from this article? Nothing for you to do, but use it.

        With regards to Fayzul’s solution, did you look over the sample accdb database provide?

  7. Febriliant Reza

    Been searching QRCode VBA since 2 years ago. Glad, I found it here! Before using your code, i used API to make a QRCode and need to connect to internet all the time.
    Thanks a lot!

    Reza

  8. Mike

    thanks for this! the only issue i can’t seem to resolve is downloading the copy of the qrCode. I keep getting an error ‘Unable to get property ‘src’ of undefined or null reference’ on this line:
    oWebBrowserObject.Document.parentWindow.execScript (“var qr = $(‘#qrcode img’)[0].src;”)
    I tried changing to this:
    oWebBrowserObject.Document.parentWindow.execScript (“var qrSrc = $(‘#qrcode img’).attr(‘src’);”)
    but then the result was just always null.

    any ideas?

    1. Mike

      Disregard…it was the issue you pointed out on IE7 being the default. By updating that, it worked great!

  9. Al

    Daniel, i tried this on ms access continuous form, and work great while the form has data, but if i clear the data after midnight, and now rows on the form, i receive message “the bound or unbound object frame you tried to edit does not contain an ole object”. Any suggestion?

    1. Daniel Pineault Post author

      I’m not sure. If your form is blank then there’s nothing for the javascript to push/pull. Probably, check for a value and stop the command if no value is present.

  10. Peter Fox

    I’m impressed. I volunteer at a Men’s Shed and am developing a database to produce name badges with QR Code to facilitate login/logout.
    The sample database produces and displays the QR Code but fails to save it.
    I have the same problem as Mike did in 2023. I get the ‘Unable to get property ‘src’ of undefined or null reference’ on this line:
    oWebBrowserObject.Document.parentWindow.execScript (“var qr = $(‘#qrcode img’)[0].src;”)
    I’m using Microsoft 365 Access on a Win 11 machine. Default browser is Edge.
    Any help/advice will be appreciated.