Solved Help with on click event of field to bring user to website (1 Viewer)

gojets1721

Registered User.
Local time
Today, 07:39
Joined
Jun 11, 2019
Messages
430
I have a single view form of customer complaints. One of the fields in the form is a customer ID field.

I'm hoping to allow the user to be able to click that ID field and it automatically open up the customer profile on our website.

The url is pretty simple. Something like "www.xyzcompany.com/customer/[customerIDfield]

Trying to figure out the simplest way to do this. Would it be utilizing the on click event for the field or another way in the field's properties?
 

561414

Active member
Local time
Today, 09:39
Joined
May 28, 2021
Messages
280
I'm going to be perceived as pedantic but table fields don't have on click events. Sorry about this minor detail, I know you're referring to a control, not a field.

Anyway, what type of control are you referring to? Are you using a hyperlink label, a textbox, a textbox with a button or something else?
 

gojets1721

Registered User.
Local time
Today, 07:39
Joined
Jun 11, 2019
Messages
430
Yes I'm sorry. It's just a textbox
 

561414

Active member
Local time
Today, 09:39
Joined
May 28, 2021
Messages
280
If the textbox serves no other purpose but to let the user click it, I'd remove the textbox and just make a button with a "View Customer" caption, on the on click event of this button, I'd include the URL and concatenate customer Id there like
FollowHyperlink "https://www.xyzcompany.com/customer/" & customerIDField

If you want the user to view the url before, then I'd use the on click event of the textbox, and I would also make the textbox look like a link. Otherwise, I'd let the textbox as is and put a button next with a "Go" or "View" caption. It can be done with a hyperlink label too but I don't like those, they do have a property that you can control though. I prefer the buttons as many times the user doesn't care about knowing the url. If the user does care about viewing the url, then I'd just place a button with a "copy url" caption before the "Go" button.

You could also have the link stored in a hyperlink type field, users should not have access to a table, but if you drag the field into your form using the existing table fields pane, Access adds a textbox already formatted and working as a link. Still, I prefer buttons.

Edit: tweaked the answer a little. Also, it is my opinion that there is no best practice for this concept, only user experience.
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:39
Joined
Feb 19, 2002
Messages
43,275
I do not use the hyperlink data type because it is not upsizeable.

You don't need to add a button, You can use the double-click event of the customerID field to run the FollowHyperlink command
 

gojets1721

Registered User.
Local time
Today, 07:39
Joined
Jun 11, 2019
Messages
430
If the textbox serves no other purpose but to let the user click it, I'd remove the textbox and just make a button with a "View Customer" caption, on the on click event of this button, I'd include the URL and concatenate customer Id there like
FollowHyperlink "https://www.xyzcompany.com/customer/" & customerIDField

If you want the user to view the url before, then I'd use the on click event of the textbox, and I would also make the textbox look like a link. Otherwise, I'd let the textbox as is and put a button next with a "Go" or "View" caption. It can be done with a hyperlink label too but I don't like those, they do have a property that you can control though. I prefer the buttons as many times the user doesn't care about knowing the url. If the user does care about viewing the url, then I'd just place a button with a "copy url" caption before the "Go" button.

You could also have the link stored in a hyperlink type field, users should not have access to a table, but if you drag the field into your form using the existing table fields pane, Access adds a textbox already formatted and working as a link. Still, I prefer buttons.

Edit: tweaked the answer a little. Also, it is my opinion that there is no best practice for this concept, only user experience.
This worked!! Thanks so much!
 

Users who are viewing this thread

Top Bottom