Others

Create a Hyperlink from a Field Value in Microsoft Access

Adam DavisAdam Davis Nov 20, 2026 868 views

Question details

Create and open a hyperlink in Microsoft Access using a value from a table or form field.

Create a Hyperlink from a Field Value in Microsoft Access
Product
Microsoft Access
Device & OS
not provided
Scenario
A user wants to construct a URL from a field value, similar to using Excel's HYPERLINK function.
Observed behavior
The desired result is a link that opens a URL containing the current field value.
Before you start

Identify the form control that contains the field value and the fixed URL components. Make sure the database is trusted or that its VBA content is enabled.

Solution 1Recommended

Open a Field-Based URL with Access VBA

Use a button's Click event to build a URL from the current form value and open it.

1
Open the form in Design View

In the Navigation Pane, right-click the form and select Design View. Confirm that the form has a control bound to the field you want to use.

2
Add a button event

Add or select a button, open its Property Sheet, and on the Event tab set On Click to [Event Procedure]. Click the builder button (...) to open the VBA editor.

3
Enter the hyperlink code

Inside the button's Click procedure, enter: If Len(Trim$(Nz(Me.[PC FAN].Value, ""))) > 0 Then Application.FollowHyperlink "https://example.com/" & Me.[PC FAN].Value & "/details" Else MsgBox "Enter a field value first." End If

4
Customize and test

Replace PC FAN with the name of your form control and change the URL components to your destination. Save the form, open it in Form View, and click the button on a record with a value.

Open a Field-Based URL with Access VBA
Check special characters: FollowHyperlink does not automatically URL-encode the field value. If values can contain spaces or reserved URL characters, encode them appropriately before concatenating the URL.
Free Microsoft Office alternative

Work with Spreadsheet Hyperlinks in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with Office documents. Open compatible spreadsheets to manage hyperlinks and move between common Office formats, though WPS does not replace Access or run its database VBA.

Create and manage hyperlinks in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX filesUse a familiar interface for everyday document tasksMove compatible Office documents into a lightweight suite
microsoft office alternative - wps office

Frequently Asked Questions

Can I open the link by clicking a field instead of a button?

Yes. In Design View, select the field control and use its Property Sheet to set On Click or On Dbl Click to [Event Procedure]. Add the FollowHyperlink code to that event.

What happens if the field is empty?

The example checks the control with Nz and Trim before opening the URL. If the value is null or contains only spaces, it displays a message instead.

Why doesn't the code run when I click the button?

Check that the button's On Click property is set to [Event Procedure] and that the code is inside its Click procedure. Also confirm that the database is trusted or its VBA content is enabled.

Can I open the URL automatically when a record is displayed?

Yes. You can place the code in the form's On Current event through the Property Sheet, but it will attempt to open a link whenever you navigate to a record.