Results 1 to 10 of 10
  1. #1
    smikkelsen is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    60

    Hyperlink Help

    I am trying to create a hyperlink in a form that uses a field as part of the url.



    For example, the url would be something like this:
    http://www.domain[field1].com

    Where field one is a string from a field in the record.

    Is this possible? I have tried a few things with no avail.

    Any help would be great!

  2. #2
    smikkelsen is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    60
    This is what i've come up with so far, but it appears as if you cannot put anything but a literal string in the hyperlink address property. when i do, it takes this as a literal string, and does not work.

    "https:/www.domain.com/something/orderid=" & Me.order

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I have done the follwoing I have Two fields a Text Field Text1 and another Hyperlink Field Hyperlink. In the form I use a command Button and type the following code:


    strHyperlink = "#" & "http://www." & Me.text1 & "#"
    Me.hyperlink = strHyperlink


    Note: The field property of the field Hyperlink is set to hyperlink and not text. In access hyperlink address should be fromatted like #http://www.google.co.in/#

    if this solves your problem mark the thread solved.

  4. #4
    smikkelsen is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    60
    I guess I am missing something.

    Here is what I have. I created a new field on the table that my form is based off. this field is called PMI_DB . I set the type to hyperlink. I added this field onto the form. I already have a second field called Order where part of the url is to be pulled from.

    I created a command button and opened the code builder and put this code in it:

    Private Sub PMI_DB_Click()
    strPMI_DB = "#" & "https://www.nmrdirect.com/pmi/hotlin...fo.asp?OrderID=" & Me.Order & "#"
    Me.PMI_DB = strPMI_DB
    End Sub


    When I click the command button, I get a runtime error 438: Object doesn't support this property or method.

    Am I missing something?

    Thanks for the help!

  5. #5
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    have you typed the code on the onclick event of the Field Text Box PMI_DB. Then it will not work. The Code has to be typed to the onClick event of a command button. Remove the code from the onclick event of the Field Text Box PMI_DB and put it in the onclick event of a command button.

  6. #6
    smikkelsen is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    60
    no, i put it on the command button. I just named them the same. Is that a problem?

    thanks

  7. #7
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    PMI_DB is the name of the Field you say you have created a Command Button also so what is the name of the command Button.

  8. #8
    smikkelsen is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    60
    Ok, it looks like that may have been the problem. i changed the button name and it works now.

    So, by clicking the button, that populates the field for me to click the link. Instead I put the code in the on open section of the form. is there a way to make the button follow the link instead?

  9. #9
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    To open the link using the command button itself you have to type the follwoing code in the OnClick event of the command Button:

    strhyperlink = "http://www." & Me.text1
    Application.FollowHyperlink strhyperlink

    Assuming you still want to get a part of the link to be a value of a field here in the example Text1

    This will do the trick. please mark this thread solved.

  10. #10
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    have you been able to solve your problem if yes mark the thread solved.

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

Similar Threads

  1. Replies: 1
    Last Post: 06-08-2010, 12:08 PM
  2. Form Variable in Hyperlink
    By russ0670 in forum Forms
    Replies: 5
    Last Post: 01-15-2010, 08:09 AM
  3. have hyperlink use own name/text
    By airhud86 in forum Access
    Replies: 1
    Last Post: 12-16-2009, 09:35 AM
  4. Hyperlink problem
    By peterl in forum Programming
    Replies: 0
    Last Post: 01-13-2009, 07:21 AM
  5. help with dynamic hyperlink to pdf
    By iresolver in forum Access
    Replies: 0
    Last Post: 12-24-2008, 01:21 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