Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    atuhacek is offline New
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2014
    Location
    Michigan
    Posts
    61
    It is two functions copy the top function in between your private sub that pops up. The second one outside.

    It will need a

    me.requery

    be for the first end sub to update the form if you still have trouble I can update for you later when I'm at a machine.

  2. #17
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by JessiRight View Post
    ...So, I guess the final question is: how do I get the strFilePath variable to transfer to the “Address” part of the hyperlink field instead of the “Text to Display” part?...
    I spent a little bit of time to understand the Hyperlink field. The issue is that you must follow the guidelines June posted with Allan's link. If you are going to send literal text, like a string, to a hyperlionk field's value, you need to give it both parts. You need to give it the Display text and also the address. Use the # qualifier to distinguish each part.

    So....

    After you have the full path with the file extension in your string variable, concatenate the second part. Concatenate the Display Text to the path/address.

    'Save the first file selected
    strFilePath = Trim(.SelectedItems(1))
    strFilePath = "Display Text#" & strFilePath & "#"

  3. #18
    JessiRight is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Posts
    9
    I did, and I get the following error message:

    Click image for larger version. 

Name:	Athuacek_Error.JPG 
Views:	11 
Size:	43.6 KB 
ID:	16993

    Although you can't see it in this picture, the first line (Private Sub cmdPickLink_Click()) is highlighted and there IS an End Sub line the bottom of the code that was automatically added when I created the Event Procedure and inserted the code.

    If I delete the first and last lines ("Private Sub cmdPickLink_Click()" and "End Sub") then it disassociates this code from the Event Procedure for the command button. Then nothing happens when I click on the button.

    I guess I still don't understand how to insert this code...

  4. #19
    atuhacek is offline New
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2014
    Location
    Michigan
    Posts
    61
    Delete the line under private sub

  5. #20
    JessiRight is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Posts
    9
    PERFECT, ITSME... (grinning from ear to ear). That's EXACTLY what I wanted! I did read through Allen Browne's two sites, but it was too much for me to follow. I do understand your explanation now, though.

    For future readers who may be as confused as I was, I have reposted below the following code that does work correctly (at least it does on my computer). THANKS AGAIN!!

    Code:
    Private Sub cmdPickLink_Click()
    Dim strFilePath As String
    
    
    With Application.FileDialog(msoFileDialogFilePicker)
    
    
        .AllowMultiSelect = False
        .Title = "Locate a file to Import"
        .ButtonName = "Import"
        .Filters.Clear
        'Change the following path location to suit your particular needs:
        .InitialFileName = "\\Inventory\Items\picPickFile.JPG"
        .InitialView = msoFileDialogViewThumbnail
        
            If .Show = 0 Then
            'There is a problem
            Exit Sub
            End If
        
        'Save the first file selected
        strFilePath = Trim(.SelectedItems(1))
        strFilePath = "Display Text#" & strFilePath & "#"
        
    End With
    
    
    'Change the "tblItems" to the name of your own table:
    strTable = "tblItems"
    
    'Change fldNotesLink to the name of your own hyperlink field in the above table:
    Me.fldNotesLink = strFilePath
    
    
    End Sub
    I will now have to find the button to "Solve" this thread.

  6. #21
    atuhacek is offline New
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2014
    Location
    Michigan
    Posts
    61
    Delete the line under private sub

    Function cmdPickFile () As variant

    may have to edit more but see if that does it.

  7. #22
    JessiRight is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Posts
    9

    Talking

    (Somehow my original response to ItsMe was accidentally deleted, so I’m reposting it.)

    Your additional line of code fixed everything, ItsMe, and it makes perfect sense. I did read through Allen Browne's two sites, but it was just too much for me to follow. I do understand your (and June's) explanation now, though.

    For future readers who may be as confused as I was, I have reposted below the following code that contains the "fixes" that make it work correctly (at least it works on my computer). THANKS AGAIN!!


    Code:
    Private Sub cmdPickLink_Click()
    Dim strFilePath As String
     
    With Application.FileDialog(msoFileDialogFilePicker)
     
        .AllowMultiSelect = False
        .Title = "Locate a file to Import"
        .ButtonName = "Import"
        .Filters.Clear
        'Change the following path location to suit your particular needs:
        .InitialFileName = "\\Inventory\Items\picPickFile.JPG"
        .InitialView = msoFileDialogViewThumbnail
        
            If .Show = 0 Then
            'There is a problem
            Exit Sub
            End If
        
        'Save the first file selected
        strFilePath = Trim(.SelectedItems(1))
        strFilePath = "Display Text#" & strFilePath & "#"
        
    End With
     
    'Change the "tblItems" to the name of your own table:
    strTable = "tblItems"
    
    'Change fldNotesLink to the name of your own hyperlink field in the above table:
    Me.fldNotesLink = strFilePath
     
    End Sub
    I will now have to look for a way to mark this thread as “Solved.”

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Browse buttons that save file path into field
    By Zandia in forum Import/Export Data
    Replies: 1
    Last Post: 06-04-2014, 02:55 PM
  2. Replies: 22
    Last Post: 02-22-2014, 02:51 PM
  3. Button to Browse for File!
    By floyd in forum Forms
    Replies: 5
    Last Post: 08-23-2013, 09:09 AM
  4. Replies: 1
    Last Post: 05-10-2011, 08:31 PM
  5. Browse for file
    By ccpine@comcast.net in forum Database Design
    Replies: 0
    Last Post: 08-24-2008, 10:12 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