Create QR code in access report (1 Viewer)

safeerbinsalih

Registered User.
Local time
Tomorrow, 00:48
Joined
Dec 30, 2015
Messages
26
Hello,

I want to create QR code in access report. I tried ID automation, not working. Any ideas/helps are deeply appreciated.
 

Isskint

Slowly Developing
Local time
Today, 19:18
Joined
Apr 25, 2012
Messages
1,302
Hi,

Not a lot for us to go on there.

How is it "not working"? what error messages are you getting? How are you generating the QR string?

I have used ID Automation in the past without any problems, although that was standard barcodes.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:18
Joined
May 7, 2009
Messages
19,169
if you have an internet connection, you may try the code in the class.
this one is written in vb. never tried it though.

first put an image control on your report for the qrcode.

on the load event of your report, get the qrcode:

dim qrCode As clsQRCode

private sub report_load()
set qrCode = New clsQRCode
' "text" means the text to make qr code, it can be from a textbox on your report
me.image_control.picture = qrCode.GetPictureQrCode("text", me.image_control.Width, me.image_control.Height)
If me.image_control.Picture Is Nothing Then MsgBox "Error!"
end sub
 

Attachments

  • QR_Code.zip
    44.2 KB · Views: 5,320

safeerbinsalih

Registered User.
Local time
Tomorrow, 00:48
Joined
Dec 30, 2015
Messages
26
Hi Issskint,

I installed IDAutomation Data Matrix Font Encoder and imported the .bas file into Modules. Then in report I created a text box and changed the control source as "=EncDM([Table_name].[Field_name])". Then I changed the font into "IDAutomation2D XLS". But It is not generating a QR.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:18
Joined
May 7, 2009
Messages
19,169
you extract the clsQRCode.cls to a folder.
on vbe, File->Import. and point to the file where you extract the class.
follow the steps on my first post.
i am unable to use this class because im lazy converting it to x64. i use x64 access.
 

cheer

Registered User.
Local time
Tomorrow, 03:18
Joined
Oct 30, 2009
Messages
222
you extract the clsQRCode.cls to a folder.
on vbe, File->Import. and point to the file where you extract the class.
follow the steps on my first post.
i am unable to use this class because im lazy converting it to x64. i use x64 access.

Error "variable not defined" at CreateBitmapPicture function

With Pic
.Size = Len(Pic) ' Length of structure
.Type = vbPicTypeBitmap ' Type of Picture (bitmap)
.hBmp = hBmp ' Handle to bitmap
.hPal = hPal ' Handle to palette (may be null)
End With
 

cheer

Registered User.
Local time
Tomorrow, 03:18
Joined
Oct 30, 2009
Messages
222
If I change the above code to the below one, no error is detected under this function. Assume "1" means bitmap file

With Pic
.Size = Len(Pic) ' Length of structure
.Type = 1 ' Type of Picture (bitmap)
.hBmp = hBmp ' Handle to bitmap
.hPal = hPal ' Handle to palette (may be null)
End With
However, error appear when returning to this

me.image_control.picture = qrCode.GetPictureQrCode("text", me.image_control.Width, me.image_control.Height)
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:18
Joined
Sep 21, 2011
Messages
14,046
From post #3
' "text" means the text to make qr code, it can be from a textbox on your report
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:18
Joined
May 7, 2009
Messages
19,169
forget about that, i think it uses
internet connection to create the qrcode.

here is another sample. doesnt
require internet connection.

there is sample form and report too.

if you want to adapt this to your db,
copy all Modules to your db.
and the AutoExec and the hiddenForm.

you need hidden form because it
is called form AutoExec macro to
instantiate Excel and extract
the excel file (the one who makes
the QR). when the applicatin closes
the hidden form does the housekeeping,
closing Excel and the excel file.
removing some other stuffs.

sorry for the sample, its unpolished.

if you have qrcode Reader on your
cellphone you can try to scan
if it is producing the correct code.
(on my test it passed all).
 

Attachments

  • aa_xlQRCode.zip
    315 KB · Views: 3,152

cheer

Registered User.
Local time
Tomorrow, 03:18
Joined
Oct 30, 2009
Messages
222
forget about that, i think it uses
internet connection to create the qrcode.

here is another sample. doesnt
require internet connection.

there is sample form and report too.

if you want to adapt this to your db,
copy all Modules to your db.
and the AutoExec and the hiddenForm.

you need hidden form because it
is called form AutoExec macro to
instantiate Excel and extract
the excel file (the one who makes
the QR). when the applicatin closes
the hidden form does the housekeeping,
closing Excel and the excel file.
removing some other stuffs.

sorry for the sample, its unpolished.

if you have qrcode Reader on your
cellphone you can try to scan
if it is producing the correct code.
(on my test it passed all).

Thanks. It works under the MS Access 2016 !!!

I am asking if you know the possibility to downgrade your attachment (all objects export out) to the MS Access 2003 platform.

I've tried but it seems produce a lot of errors. Any shortcut method to eliminate all errors ?
 

isladogs

MVP / VIP
Local time
Today, 19:18
Joined
Jan 14, 2017
Messages
18,186
If you can't convert Arnel's code to 2003, you might want to look at this link:
http://www.barcode-soft.com/qrcodeaccess.aspx

I just googled it so can't vouch for how well it works - however it says its for Access 2003
BUT its commercial software ... at a price

Another google hit was to this: https://stackoverflow.com/questions/15303247/creating-2d-data-matrix-or-qr-codes-in-ms-access-reports-forms

Once again I haven't tried it ....

Depending on the volume of codes you need to generate, you could use the Google Charts API to generate QR Codes.

Simply add a "Microsoft Web Browser" ActiveX component and the following code to your Form:

Code:
Dim Size As Integer
Dim Text As String
Dim URL As String
Size = 200
Text = "This is my test"
' Better to actually use a URL encoding function like those described here:
' http://stackoverflow.com/questions/218181/how-can-i-url-encode-a-string-in-excel-vba
Text = Replace(Text, " ", "%20")
URL = "http://chart.apis.google.com/chart?chs=" & Size & "x" & Size & "&cht=qr&chld=H|0&chl=" & Text
WebBrowser.Navigate (URL)

You can of course change the Size and the Text depending on your need. The Text can also be a value directly from your Form, therefore your data.

I would advise you to check Googles Terms and Services before using it.
 

cheer

Registered User.
Local time
Tomorrow, 03:18
Joined
Oct 30, 2009
Messages
222
forget about that, i think it uses
internet connection to create the qrcode.

here is another sample. doesnt
require internet connection.

there is sample form and report too.

if you want to adapt this to your db,
copy all Modules to your db.
and the AutoExec and the hiddenForm.

you need hidden form because it
is called form AutoExec macro to
instantiate Excel and extract
the excel file (the one who makes
the QR). when the applicatin closes
the hidden form does the housekeeping,
closing Excel and the excel file.
removing some other stuffs.

sorry for the sample, its unpolished.

if you have qrcode Reader on your
cellphone you can try to scan
if it is producing the correct code.
(on my test it passed all).

Running at FRESH ACCDB , it works !!!

But if import all MS Access objects into current application ACCDB (Around 36MB), the error is shown at the attachment. Not too sure it has something to do with the ACCDB file size or not .
 

Attachments

  • Error.jpg
    Error.jpg
    97.7 KB · Views: 1,064

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:18
Joined
May 7, 2009
Messages
19,169
based on the message, you need
a bmp file, so i've made changes
and instead of jpeg being produced,
a bmp file instead.
 

Attachments

  • aa_xlQRCode.zip
    316 KB · Views: 2,339

bejaranoangel

New member
Local time
Today, 12:18
Joined
Jun 24, 2014
Messages
11
forget about that, i think it uses
internet connection to create the qrcode.

here is another sample. doesnt
require internet connection.

there is sample form and report too.

if you want to adapt this to your db,
copy all Modules to your db.
and the AutoExec and the hiddenForm.

you need hidden form because it
is called form AutoExec macro to
instantiate Excel and extract
the excel file (the one who makes
the QR). when the applicatin closes
the hidden form does the housekeeping,
closing Excel and the excel file.
removing some other stuffs.

sorry for the sample, its unpolished.

if you have qrcode Reader on your
cellphone you can try to scan
if it is producing the correct code.
(on my test it passed all).

Thank you :):):) this works like a charm....
 

psycoperl

New member
Local time
Today, 15:18
Joined
Apr 16, 2009
Messages
7
Is it possible to "reformat" the QRCode so that it will have a specific foreground and background colors?

We are looking to print the qr code in Dark Blue with a light gray background.
 

psycoperl

New member
Local time
Today, 15:18
Joined
Apr 16, 2009
Messages
7
I know that QRCodes can be made in colors as we use them when we are using MSWord Mail Merge and ZINT Barcode Studio to create them.

What I am just trying to find out is how to modify the template that arnelgp had provided. I am trying to see if there is a setting somewhere or is there alot of code to change.

Best,
 

Users who are viewing this thread

Top Bottom