BarCodeWiz Logo

Create Swiss QR-Bills in Microsoft Access with BarCodeWiz QR Code Fonts

  • The Swiss QR-bill is a standardized payment format used in Switzerland. It includes a QR Code containing invoice information such as the recipient's bank account, address, payment amount, and currency.
  • This tutorial demonstrates how to create a Swiss QR-bill invoice in Microsoft Access using BarCodeWiz QR Code Fonts. You will learn how to generate a QR Code containing the required information, add the Swiss Cross to its center, and include it in an invoice report.

Step 1. Import module with barcode functions

Click on Database Tools tab > Visual Basic (or press Alt + F11).


Right-click the database and Import File....


  • Select BarCodeWizQrCode.bas
  • The default location of the file is:
    C:\Program Files\BarCodeWiz\BarCodeWiz QR Code Fonts\BarCodeWizQrCode.bas

The following module should now be part of the Access file.


Step 2. Create a new table

Create a new table with invoice data. Name the table InvoiceData (or use the InvoiceData table from our example database). Our table has the following fields and data:

Sample InvoiceData table showing 29 fields and values for a Swiss QR-bill invoice.

Step 3.  Create a new report in Design Mode

  • In Microsoft Access, select the Create tab and click Report Design.
Microsoft Access Create tab with the Report Design button highlighted.

  • Open the report's Property Sheet (press F4) and select the Data tab.
Microsoft Access report in Design View with the Property Sheet and Data tab highlighted.

  • Set the Record Source property to InvoiceData, the table created in Step 2.
Setting the report's Record Source property to InvoiceData in Microsoft Access.

  • Save the report as rpt_Rechnung.
Saving the Microsoft Access report as rpt_Rechnung in Design View.

Step 4. Generate Swiss QR Code

  • On the Report Design tab, select Text Box and place it in the payment section of the invoice within the report's Detail section.
Microsoft Access Report Design tab showing the Text Box control selected from the Controls menu

New text box inserted into the Detail section of a Microsoft Access report.

  • Select the text box and open its Property Sheet (F4). On the Data tab, locate the Control Source property.
Microsoft Access Property Sheet showing the Control Source property of the selected text box.

  • Enter the following expression in the Control Source property to generate the Swiss QR Code using the invoice data from the InvoiceData table.

 

=QrCodeEncode("SPC" & Chr(13) & Chr(10) & "0200" & Chr(13) & Chr(10) & "1" & Chr(13) & Chr(10) & Replace([IBAN]," ","")
 & Chr(13) & Chr(10) & "S" & Chr(13) & Chr(10) & [SellerName] & Chr(13) & Chr(10) & [SellerAddress] & Chr(13) & Chr(10)
 & [SellerBuildingNumber] & Chr(13) & Chr(10) & [SellerPostalCode] & Chr(13) & Chr(10) & [SellerCity] & Chr(13) & Chr(10)
 & "CH" & Chr(13) & Chr(10) & "" & Chr(13) & Chr(10) & "" & Chr(13) & Chr(10) & "" & Chr(13) & Chr(10) & "" & Chr(13) &
 Chr(10) & "" & Chr(13) & Chr(10) & "" & Chr(13) & Chr(10) & "" & Chr(13) & Chr(10)
 & Replace(Format([GrossTotal],"Fixed"),",",".") & Chr(13) & Chr(10) & [Currency] & Chr(13) & Chr(10) & "S" & Chr(13)
 & Chr(10) & [BuyerName] & Chr(13) & Chr(10) & [BuyerAddress] & Chr(13) & Chr(10) & [BuyerBuildingNumber]
 & Chr(13) & Chr(10) & [BuyerPostalCode] & Chr(13) & Chr(10) & [BuyerCity] & Chr(13) & Chr(10) & "CH" & Chr(13)
 & Chr(10) & "NON" & Chr(13) & Chr(10) & "" & Chr(13) & Chr(10) & [Reference] & Chr(13) & Chr(10)
 & "EPD",1,2,False,4,0,"UTF-8")

  • On the Format tab, set the Font Name to BCW_QR and the Font Size to 4. Adjust the text box dimensions to accommodate the generated QR Code. The exact QR Code dimensions will be adjusted in Step 6.
Microsoft Access Property Sheet showing the BCW_QR font and font size 4 for the QR Code text box.

Step 5. Design the Swiss Invoice

  • Add labels and text boxes for the seller's and buyer's information, invoice number, dates, and payment details.

  • In Design View, arrange the invoice fields and labels to create the invoice layout.

  • Add text boxes for NetTotal, VATTotal, and GrossTotal. Format the amounts to display two decimal places.
Microsoft Access report in Design View showing the invoice totals section with NetTotal and VATTotal text boxes selected.

  • Switch to Print Preview to check the invoice layout and make any necessary adjustments.
Microsoft Access Print Preview showing a Swiss QR-bill invoice with seller and buyer details, payment amounts, and a QR Code.

Step 6 — Add the Swiss Cross

  • Adjust the QR Code to measure 46 × 46 mm, excluding the quiet zone.

  • On the Report Design tab, select Image from the Controls menu.
  • Insert an image of the Swiss Cross (a white cross on a black square) and set its dimensions to 7 × 7 mm.
  • Position the Swiss Cross in the center of the QR Code. Use the Left and Top properties on the Format tab of the image's Property Sheet to adjust its position manually. The exact values depend on the report layout.

  • Make sure the Swiss Cross is centered over the actual QR Code rather than the text box itself. Switch to Print Preview to check the alignment and make any necessary adjustments.