Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlink

Status
Not open for further replies.

Tootle

Programmer
Sep 25, 2002
21
GB
Ok for some reason i cant get my head around this

i want to be able to click a button and in VBA i want that button to open a URL whatever i try doesnt seem to work any help would be appreciated.

Andy
 
Tootle: In the OnClick event put:

Me![cmdButton].HyperlinkAddress = Forms![frmEditPhotos]![Path]

..notice that you can create your path string and substitute it in, e.g.,

Dim strNo As String
strNo = "C:\MyPics\01\" & Forms![frmMyForm]![No]
Me![cmdButton].HyperlinkAddress = "P43" & strNo & ".jpg"

...etc, etc. Note too Tootle that when you're working with "Paths" it is a good idea to always reference your database so that the client doesn't have to line up with, e.g.,

C:\Myfolder1\Myfolder2\Myimages\....

Say your database is in Myfolder2, then do the following:

Dim strPath As String
strPath = CurrentProject.Path

Now "strPath" is equal to "C:\Myfolder1\Myfolder2\"

...and the user can move the database to a new location and all is well. strPath will change right along with it; always reflecting where the "mdb" file is. Then in your code, you only provide the remaining part of the path, e.g.,

strNo = "C:\MyFolder1\MyFolders2\" & Forms![frmMyForm]![No]& ".jpg"

becomes

strNo = strPath & Forms![frmMyForm]![No] & ".jpg"

...hope this helps.
 
Not sure if i explained myself enough

i have an activex sidebar and what i want to do is click a button in there to open a URL
for instance i have a Statusbar and on click of a button i have the code StatusBar.panels(3) = "Reports" this sets one of the panels to say Reports i also have it opening forms etc with docmd.openform "[FormName]" but i need the code to open up a URL if that explains it a bit more

Thanks

Andy

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top