QR Code generator (image) using Zxing (Zebra Crossing) library

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:14
Joined
May 7, 2009
Messages
19,795
This is an MS Access adaptation
of ZXing (Zebra Crossing) QR Code
generation.

There are many tutorial on the web
about this and include examples
in excel files.

Extract all files/folders
to the folder of your choice.

Register the Library by running
register.cmd found inside
ZXing_Library folder.

If you encounter error while
registering the library,
copy the while ZXing_Library folder
to drive C:\, (you will then need to have
C:\ZXing_Library after copying).
run register.cmd on that folder.

after successfully registering.
you add Rerefence (on VBA,
Tool->References) to the library
by browsing to the library list
and finding:

"port of java based barcode scanning library for .net ..."

this is but a demo of QR Code.
the library supports other types of 1-D and 2-D
barcodes (https://github.com/zxing/zxing)
 

Attachments

Wonderful.

I'm using this in my project.
Thanks to @arnelgp . Credit goes to him as I'm using the codes he wrote and adapt it in my project and it's working :).

Capture d’écran 2023-01-03 001829.jpg

I can now generate the QR Code directly from the form and store it in a field with the picture saved to the project folder.

But one little issue that I notice is when I go to last record I find on the QR image control the previous generated QR until I clic to generate a QR for the new record (as you can see on screenshoot below).

Capture d'écran_20230103_165345.png


Only if I close the form and reopen it I will find the blank image control for a new record.

Capture d'écran_20230103_165516.png

Here is the code:

Code:
Private Sub btngenerer_Click()
    
    Dim qr_path As String
    
    qr_path = CurrentProject.Path & "\Images\QR"
    
    ForceCreateDir qr_path
    
    qr_path = qr_path & "\" & CodeAd & ".png"
    
    If IsNull(Me!CodeAd) Then
        
        Else
        On Error Resume Next
        Kill qr_path
        On Error GoTo 0
        Call Encode_To_QR_Code_To_File(Me!CodeAd, qr_path)
        
        Me!qrField.Picture = qr_path
        
        Me.cheminqr.Value = qr_path
        
    
    End If
    
End Sub

Private Sub ForceCreateDir(ByVal sPath As String)

    Dim var As Variant
    Dim p As String
    Dim i As Integer
    var = Split(sPath, "\")
    On Error Resume Next
    For i = 0 To UBound(var)
        p = p & var(i)
        VBA.MkDir p
        p = p & "\"
    Next
    
End Sub

Possible there is a mistake somewhere.
 
Well I would expect the image to change for each record, so probably some code required in the Current event to assign or clear the image?
 
Your missing some code; if nothing then do nothing?

If IsNull(Me!CodeAd) Then

Else

surely Me!qrField.Picture.visible = false or something
 

Users who are viewing this thread

Back
Top Bottom