Office Settings & Configuration

Fix Microsoft Access Report Cannot Find Public VBA Function for Images

Muhammad TalhaMuhammad Talha Oct 16, 2026 870 views

Question details

Users encounter parameter prompts or duplicate image outputs when an image control in an Access report tries to call a public VBA function for multiple records.

How to Fix Microsoft Access Report Cannot Find Public VBA Function
Product
Microsoft Access
Device & OS
not provided
Scenario
Generating dynamic images such as unique QR codes for multiple records on a single report page.
Observed behavior
The report prompts for a parameter indicating it cannot find the VBA function, or it incorrectly applies the image from the first record to all subsequent records because the function is called during the On Load event.
Before you start

Verify that your public VBA function is placed inside a standard module rather than a form or report module to ensure it is globally accessible to the entire database.

Solution 1Recommended

Bind the VBA Function to the Detail Section's Format or Print Event

Moving the VBA function call from the Report's On Load event to the Detail section's On Format or On Print event ensures the image generates correctly for every individual record.

When a report loads, the On Load event fires only once. If you assign an image or call a function here, Access applies the first record's data to all subsequent records on the page. To generate unique values like distinct QR codes for each row, you must trigger the function as each record is individually formatted or printed.

1
Open Design View

Right-click your Microsoft Access report in the navigation pane and select Design View.

2
Select the Detail Section

Click directly on the background of the Detail section to highlight it.

3
Open the Property Sheet

Press F4 to open the Property Sheet on the right side of the screen, and switch to the Event tab.

4
Access the On Format or On Print Event

Locate the 'On Format' or 'On Print' event line, click the ellipsis (...) button next to it, and select Code Builder.

5
Call Your VBA Function

Write your VBA code within this event procedure, passing the current record's data to your public function to dynamically update the Image control's Picture property.

Bind the VBA Function to the Detail Section's Format or Print Event
Event Timing Best Practice: The On Format event is ideal for altering layout properties before printing, while the On Print event is best utilized when data is actively being sent to the printer. Both will correctly loop through your records.
Free Microsoft Office alternative

Looking for a Lightweight Office Suite? Try WPS Office

While Microsoft Access is strictly for complex databases, your everyday document processing, spreadsheet analysis, and presentations can be streamlined with WPS Office. It provides a lightweight, highly compatible alternative to Microsoft Office without the subscription fees.

Fully compatible with Microsoft Word, Excel, and PowerPoint formats (.docx, .xlsx, .pptx).Easily import, format, and analyze exported Access database reports and CSV files using WPS Spreadsheet.Free, lightweight, and features a familiar ribbon interface for a zero-learning-curve transition.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Access report prompt for a parameter when calling a VBA function?

This typically occurs if the function name is misspelled in the Control Source, if the function is declared as Private, or if it is isolated inside a specific form or report module rather than a globally accessible Standard Module.

Why is the same QR code showing for every record on my Access report?

If you assign the image property using the report's On Load event, Access only evaluates the first record. To generate a unique QR code for each record, move the VBA code to the Detail section's On Format or On Print event.

Where should I place a public VBA function so my entire Access database can use it?

You should place global functions in a Standard Module. Go to the Database Tools tab, click Visual Basic, insert a new Module (not a Class Module), and declare your function using the 'Public' keyword.