Results 1 to 3 of 3
  1. #1
    Xarkath is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Millcreek WA
    Posts
    92

    Hyperlink trouble

    MS Access 2013




    Hello, I have looked around and tried a handful of solutions found on different sites to get hyperlinks to work but so far nothing has worked so I am hoping someone here can help me out.

    I have a client table that contains a a hyperlink field. These links are to a network drive that contains one folder per client used for housing source documents. The hyperlinks work from 1) the table 2) a data entry form used for setting up a new client and 3) a form used to maintence an existing client setup. Since it works in all 3 of those it seems I should be able to add it to a third form. This last form is used to track yearly maintence updates and I just want to add the link to avoid having to open an additional form just to use the hyperlink. In short, it is a convenience thing. The only difference is that the form is not directly bound to the client table as the other 2 are so I assume I have to use something like DLookup but no matter how I set it up it always comes back with a null value. The value needs to update as the form moves from one client to next which is not a problem for other data types; I do it all the time, but I seem to be missing something about hyperlinks. I would perfer a button control but would be happy enough with a text control if that is what it needs to be so long as it works.

    Any advice would be greatly appreciated.

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you can also use this code...
    Paste this code into a module, and it will open ANY file in its native application.

    usage: OpenNativeApp "c:\folder\file.pdf"
    will open it in acrobat
    or
    OpenNativeApp ME.txtBox
    will open the doc in Word if the item in txtBox is C:\myfile.doc
    or a hyperlink.

    Code:
    'Attribute VB_Name = "modNativeApp"
    'Option Compare Database
    Option Explicit
    
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long
    
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    Const SW_SHOWNORMAL = 1
    Const SE_ERR_FNF = 2&
    Const SE_ERR_PNF = 3&
    Const SE_ERR_ACCESSDENIED = 5&
    Const SE_ERR_OOM = 8&
    Const SE_ERR_DLLNOTFOUND = 32&
    Const SE_ERR_SHARE = 26&
    Const SE_ERR_ASSOCINCOMPLETE = 27&
    Const SE_ERR_DDETIMEOUT = 28&
    Const SE_ERR_DDEFAIL = 29&
    Const SE_ERR_DDEBUSY = 30&
    Const SE_ERR_NOASSOC = 31&
    Const ERROR_BAD_FORMAT = 11&
    
    
    Public Sub OpenNativeApp(ByVal psDocName As String)
    Dim r As Long, msg As String
    
    r = StartDoc(psDocName)
    If r <= 32 Then
        'There was an error
        Select Case r
            Case SE_ERR_FNF
                msg = "File not found"
            Case SE_ERR_PNF
                msg = "Path not found"
            Case SE_ERR_ACCESSDENIED
                msg = "Access denied"
            Case SE_ERR_OOM
                msg = "Out of memory"
            Case SE_ERR_DLLNOTFOUND
                msg = "DLL not found"
            Case SE_ERR_SHARE
                msg = "A sharing violation occurred"
            Case SE_ERR_ASSOCINCOMPLETE
                msg = "Incomplete or invalid file association"
            Case SE_ERR_DDETIMEOUT
                msg = "DDE Time out"
            Case SE_ERR_DDEFAIL
                msg = "DDE transaction failed"
            Case SE_ERR_DDEBUSY
                msg = "DDE busy"
            Case SE_ERR_NOASSOC
                msg = "No association for file extension"
            Case ERROR_BAD_FORMAT
                msg = "Invalid EXE file or error in EXE image"
            Case Else
                msg = "Unknown error"
        End Select
    '    MsgBox msg
    End If
    End Sub

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    besides 256's advice; just in general terms:you could use a sub form that is bound on the table holding the hyperlink - or - potentially your main form could be bound to a query that joins your maintenance table to your client table although not knowing your data structure I can't say for sure.....

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

Similar Threads

  1. Hyperlink
    By sahand in forum Forms
    Replies: 2
    Last Post: 04-21-2014, 04:33 AM
  2. Replies: 4
    Last Post: 01-05-2013, 11:07 AM
  3. Replies: 4
    Last Post: 01-31-2011, 03:19 PM
  4. Where is the hyperlink....
    By amer in forum Queries
    Replies: 1
    Last Post: 06-09-2010, 12:06 PM
  5. Hyperlink Help
    By smikkelsen in forum Access
    Replies: 9
    Last Post: 03-12-2010, 11:28 AM

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