DoCmd.RunCommand acCmdInsertHyperlink (1 Viewer)

doco

Power User
Local time
Today, 06:17
Joined
Feb 14, 2007
Messages
482
Code:
A simple text box being populated by a command button instancing the DoCmd in the subject line. I have used this extensively over the years and it works fine until now.

Code:
Private Sub cmdImage_Click()

    Me.image_path.SetFocus
    Call InsertPhotoLink
    
End Sub

Public Sub InsertPhotoLink()

    On Error GoTo insertPhotoLink_Err

    DoCmd.RunCommand acCmdInsertHyperlink

insertPhotoLink_Exit:
    Exit Sub

insertPhotoLink_Err:
    MsgBox Err.Description
    Resume insertPhotoLink_Exit
    
End Sub

Running Win7 Pro and Office 2013 Pro

The problem is every time this runs it creates a new folder share on my computer. I have checked other databases that uses this command and they work as expected.

Why would this happen?

TIA
 

spikepl

Eledittingent Beliped
Local time
Today, 15:17
Joined
Nov 3, 2010
Messages
6,142
What is "folder share"?
 

doco

Power User
Local time
Today, 06:17
Joined
Feb 14, 2007
Messages
482
Map to a network drive.

EG: Z:\\etc, etc,
 

doco

Power User
Local time
Today, 06:17
Joined
Feb 14, 2007
Messages
482
I still do not know why the acCmdInsertHyperlink command creates a network folder share on my computer and cannot get it to quit. So, the next best thing is a work around:

Code:
Private Sub cmdInsertLink_Click()

    Dim fFile As Office.FileDialog
    Dim vFile As Variant
    
    Set fFile = Application.FileDialog(msoFileDialogFilePicker)
    
    With fFile
    
        .AllowMultiSelect = False
        .Title = "SELECT PRIMARY IMAGE"
        .Filters.Clear
        .Filters.Add "Image File", "*.JPG, *.JPEG"
        .Filters.Add "All Files", "*.*"
        
        If .Show = True Then
            For Each vFile In .SelectedItems
                Me.image_path.Value = vFile & "#" & vFile & "#"
            Next vFile
        Else
            MsgBox "No Selection Made", vbInformation + vbOKOnly, "Image File"
        End If
    
    End With
    
End Sub

Thanks
doco:banghead:
 

Users who are viewing this thread

Top Bottom