0
votes

Our company has a web-based employee directory which I'm trying to link to from an Access 2013 Desktop Database application. The links to users' profiles look something like this: https://mysite.example.com?Person.aspx?guid=9eda6bb0-6b6b-492e-adbb-3c39e8a7fcd0

When I visit that URL directly in my browser (IE9), I am automatically authenticated and redirected to that user's profile. When I create a URL hyperlink on my desktop and launch it, IE9 is launched and I am redirected to that user's profile. When I set an Excel cell's value to that URL and click on the resulting hyperlink, same behaviour. When I click on that hyperlink in Word, again, same behaviour.

The link even works if you embed a Web Browser control in the access form and set its URI to the desired location, even if the link is subsequently opened in the user's external browser. I happened to discover this quirk by chance.

The problem is when I create a hyperlink to that URL from my Access application and click on it, IE9 launches and visits that URL, but I get the following error message:

There was a problem accessing the site. Try to browse to the site again. If the problem persists, contact the administrator of this site and provide the reference number to identify the problem. Reference number: dc40e099-a58d-472d-b187-ac162d399e28

which seems to be a standard authentication error from IIS (Microsoft Internet Information Services framework).

I experience the same problem when using the FollowHyperlink function from Access VBA.

The only way I have been able to workaround this is to use the VBA command: Shell "explorer " & Chr(34) & "https://mysite.example.com/Person.aspx?guid=9eda6bb0-6b6b-492e-adbb-3c39e8a7fcd0" & Chr(34) on my element's Click method, but the element doesn't behave like a native hyperlink should (no automatic hyperlink styling, no "hand" cursor, etc.), and I'm also incredibly curious why Access' hyperlinks behave so differently from other Windows/Office hyperlinks.

Any ideas?

1
I think the problem relates to your hyperlinks containing query parameters contained within them (everything following the ? in the link). I would assume you can follow a hyperlink to just a website such as www.google.com? If you can't then you've done something wrong as this is simple enough. If you can - well I dont know the answer you need, but look for something to do with "ms-access hyperlink query parameters"John Bingham
That's a good thought, but I was successfully able to link to https://www.google.com?q=test+query. I think the problem is with some session/cookie tracking, but I don't know exactly what.StockB

1 Answers

2
votes

In the absence of a real solution to the root cause of the problem (Access' broken session handling), I have forged ahead with a workaround, which behaves closely (but not identically) with Access' native hyperlinks.

I changed the Hyperlink Address property of my label control from https://mysite.example.com/Person.aspx?guid=9eda6bb0-6b6b-492e-adbb-3c39e8a7fcd0 to (a single space). The space is there so that the label appears to be a hyperlink, yet doesn't redirect the user to a URI when it is clicked

I then set the label's OnClick event to a VBA subroutine. That subroutine contains the following code: Shell "explorer " & Chr(34) & "https://mysite.example.com/Person.aspx?guid=9eda6bb0-6b6b-492e-adbb-3c39e8a7fcd0" & Chr(34). This line of code opens the link in explorer, which should open the hyperlink in the user's default browser.

When clicked, the link will open the browser and redirect to the desired page after authentication. This workaround works because it bypasses Access' default hyperlink redirection, which contains broken session handling. I encourage Microsoft's Access team to look into this issue as soon as possible.

Additionally, by setting the control's ControlTip Text property (In the "Other" tab), you can set the hover tooltip to display the destination URL just like a real hyperlink (or to some other descriptive text if you so desire).

The result is a component which looks, feels, and acts like a hyperlink, but isn't a hyperlink. Hopefully Microsoft fixes this soon so this won't be necessary but for the time being, it works great.