Solved Open Explorer according FilePath filed (1 Viewer)

TipsyWolf

Member
Local time
Today, 02:01
Joined
Mar 20, 2024
Messages
211
Hello, guys, i have a feature that allows me to store pictures outside of a db. it can save to specific folder, rename as i need so everything is in an order and also delete.

1719236584383.png


BUT unlike attachment type, i can't here open this picture via default picture viewer - i mean i can't open this pic when i need, for example, to get some few extra details from it .. like, maybe zoom. it just a thumbnail.

Im sure there is a way to code so access will open this pic reading filepath field or if its not possible to open this pic, then maybe there is a way to just open a explorer with filepath in its address bar and pre-select this picture so user dont need to search through hundreds of them by scrolling.

here is a code of attaching pic.
Code:
Private Sub attachcall_Click()
Dim fd As FileDialog
Dim i As Integer


Set fd = Application.FileDialog(msoFileDialogOpen)
    With fd
        .AllowMultiSelect = False
      
        'show only set of extension file in dialog
         .Filters.Clear
         .Filters.add "Image file", "*.jpeg;*.png;*.jpg;*.gif", 1
      
        If .Show = -1 Then
            For Each VtrselectItem In .SelectedItems
            For i = Len(VtrselectItem) To 1 Step -1
                If Mid(VtrselectItem, i, 1) = "." Then
                ext = Mid(VtrselectItem, i)
              
                Exit For
                End If
              
                Next i
                Me.FilePath = VtrselectItem
              
                ' if folder name doesnt exist then make new one
                On Error Resume Next
                MkDir "C:\Images\"
                On Error GoTo 0
              
                'if folder exist, copy image to distination folder
                'file name in the drive C:\
                FileCopy VtrselectItem, "C:\Images\" & "RiskID_" & Me.RiskID & "_" & "before" & ext
                Me.FilePath = "C:\Images\" & "RiskID_" & Me.RiskID & "_" & "before" & ext
                Me.PictureName = "RiskID_" & Me.RiskID & "_" & "before" & ext
              
                Next VtrselectItem
              
                Else
                'display when no file is selected
                MsgBox "No File Selected.", vbInformation, ""
              
              
      
            End If
            Set fd = Nothing
End With

End Sub

please any idea how to make a separate code for opening it ?
 

theDBguy

I’m here to help
Staff member
Local time
, 16:01
Joined
Oct 29, 2018
Messages
21,684
Have you tried using the FollowHyperlink method?

For example: Application.FollowHyperlink Me.FieldName
 

TipsyWolf

Member
Local time
Today, 02:01
Joined
Mar 20, 2024
Messages
211
Have you tried using the FollowHyperlink method?

For example: Application.FollowHyperlink Me.FieldName

i set for "open" button

Code:
Private Sub openacall_Click()

Application.FollowHyperlink Me.FilePath
 
End Sub

and it WORKED ! amazing. 1 line of code. so simple.

1719237678209.png
 

Users who are viewing this thread

Top Bottom