How to open a URL from MS Access with parameters

Application.FollowHyperlink is fickle.

Use either ShellExecute:
Open an html page in default browser with VBA?

or

CreateObject("Shell.Application").Open "http://example.com/index.php?r=controller/action&id=" & Me.ID 

see https://stackoverflow.com/a/18922262/3820271


If the URL is in a string variable, you may need to cast it to Variant, because that's what Shell.Application.Open expects:

strUrl = "http://example.com/index.php?r=controller/action&id=" & Me.ID
CreateObject("Shell.Application").Open CVar(strUrl)

see https://stackoverflow.com/a/56173911/3820271, thanks Toby and Anthony for pointing this out!


Note that if you are having issues with CreateObject("Shell.Application").Open not working with a variable, it might be a casting issue - try tossing a CVar() around the parameter. See https://stackoverflow.com/a/56173911/8512931 for more details.

Tags:

Url

Ms Access

Vba