Results 1 to 7 of 7
  1. #1
    wex65 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    4

    Constructing a hyperlink to use field values

    I have a form in Access 2007 that I use daily to view members of my online business.

    I would like to have a hyperlink on the form that allows me to click and be taken directly to their online profile page.

    So, for example if I have a member with a Member_ID field with a value of 442 I want a link to the URL mydomain.com/user/442.

    It appears that adding a hyperlink to the form only allows me to use text and not include fields?

    What I ideally want is something like:

    "http://www.mydomain/user/" & 'Member_ID'



    So, if I am viewing member 235 the URL will end in 236.

    I hope this makes sense.

    Thanks in advance for any help provided.

    Regards,

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    You're close; no quotes around the field:

    "http://www.mydomain/user/" & Member_ID
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    wex65 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    4
    Thanks, almost there.

    I am using code to change the HyperlinkAddress property for the label each time I step to a new member:

    Dim MyURL As String
    MyURL = "http://www.mydomain.com/user/" & Member_ID
    Label132.HyperlinkAddress = MyURL

    However, I am getting the following error. This appears to indicate that the URL itself is correct but not accessible.

    Unable to open http://www.mydomain.com/user/2. Cannot download the information you requested.

    Doing a little further testing it appears it is the inclusion of a number that makes if fail!

    If I change a member's last name to com and then change code as below it works fine.

    MyURL = "http://www.mydomain." & LastName

    So, it can concatenate the domain and further characters (com) it works fine BUT will not accept a number??

    If I ignore code and simply try to directly make the property (http://www.mydomain.com/user/2) it fails with the same message.

    Curiously if I use a fictitious user ID (say 99999999) it DOES realize that this page does not exist giving a new message:

    Unable to open http://www.domain.com/user/999999999. The internet site reports that the item you requested could not be found. (HTTP/1.0 404).

    So, in short I am fine as long as the URL does not include a number, which every member ID does. Very annoying.

    By the way, I did add StrConv() to convert the whole thing to lowercase but that didn't help either.

    I don't see anything online to indicate you cannot include numerics?

    Thanks for any help you can provide.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    I don't think there should be any problem with numbers, as long as that's what the site is expecting. I noticed the link to this thread ended with a number so I tested this, which worked fine.

    Dim strLink As String
    strLink = "https://www.accessforums.net/forms/constructing-hyperlink-use-field-values-17479.html#post"
    strLink = strLink & 80011

    Application.FollowHyperlink strLink
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    wex65 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    4
    OK, I think I see the real issue now although I still need to resolve it.

    First, you were using a different method so I switched to using the code you posted and stuck it behind a command button.

    As with you, it worked. I switched to my URL on my site, it failed.

    Then a light bulb came on in my head. The URL I am trying to access is an admin page which I have to be logged into the site to be able to access. Otherwise I will get a 'not authorized' error or some similar thing.

    To test this I tried with a URL on my site that is accessible to the public and it worked fine. I then tried an admin page and it failed. So, the issue is that Access is not using my current login session EVEN THOUGH when I click on the button it opens the same browser (Firefox)???

    Just to be safe I also opened IE and logged that browser in too. So, the only two browsers on my PC are both logged in as admin and yet a link to an admin page is failing because I am guessing Access isn't being seen as "logged in".

    I am now 100% convinced this is the issue but I am scratching my head as how to get Access to use my existing session. Can i not just force Access to pass the URL to a 3rd party browser (which is surely all it does anyway?).

    I really appreciate your feedback as it has helped me narrow down the exact problem.

    Regards,

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    I'm no expert on what happens in the background, but as far as I know Access is just passing the URL to whatever your default browser is. The only site I have experience with accessing programmatically that requires a login allows the login to be passed in the URL.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    wex65 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    4
    Thanks, I will continue to try to get to the bottom of this. If I find a solution I will post back with it.

    Regards,

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-31-2011, 03:19 PM
  2. Use a lookup field to influence values in another field
    By nathanrt in forum Database Design
    Replies: 3
    Last Post: 01-13-2011, 03:40 PM
  3. IIf using other field values in same query
    By ErikaMarie0421 in forum Queries
    Replies: 2
    Last Post: 08-03-2010, 12:21 PM
  4. Hyperlink to a specific Field/Cell?
    By tbutters in forum Database Design
    Replies: 8
    Last Post: 06-04-2010, 12:27 PM
  5. clear field values
    By surrendertoo in forum Queries
    Replies: 0
    Last Post: 02-23-2008, 10:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums