none
Can not open picture by window photo viewer from link on access 2016 RRS feed

  • Question

  • HI all. When i create form and database from access 2013 in which I coded for one button to open picture according its link. It runs quite well. However when i open it by access 2016 it can not perform. I don not know what is different from both version . How to solve this issue. please give me your advice. Thank in advance
    Wednesday, April 4, 2018 6:21 AM

All replies

  • Hi,

    Let me confirm:
    (1) Is Access 2016 running in the same computer where Access 2013 has been installed? Or they are running in different computers?
    (2) Where DB (tables) is located, in local computer(s), in a file sever, or in NAS? 
    (3) Which is architecture of Access 2013 and 2016, 32-bit or 64-bit?

    Regards,

    Ashidacchi -- http://hokusosha.com/

    • Edited by Ashidacchi Wednesday, April 4, 2018 7:26 AM
    Wednesday, April 4, 2018 7:24 AM
  • Hi guy

    The answer is below:

    1. Access 2016 is running in the different computer

    2. DB is located in share server (share drive) where all users can access fully

    3. the system is 64 bit

    note: this is package with copy right of MS

    Wednesday, April 4, 2018 8:38 AM
  • Hi guy

    The answer is below:

    1. Access 2016 is running in the different computer

    2. DB is located in share server (share drive) where all users can access fully

    3. the system is 64 bit

    note: this is package with copy right of MS

    Thank you for reply.

    Your wrote "the system is 64 bit". What do you mean by "system"? Does it mean "Access", instead of "Windows"?  (I'd like to know architecture of "Access")

    Is a drive letter (maybe, mapped drive letter) the same between computers? i.e. a computer running Access 2016 has a different drive letter (or path) from a computer of Access 2014.
    Please check if both computers have the same path where DB (tables) is located. 

    Regards,

    Ashidacchi -- http://hokusosha.com/

    Wednesday, April 4, 2018 9:13 AM
  • Make sure your copy of Access/Office 2016 is up to date.   There is a known bug in early releases of Access 2016 in which embedded pictures on forms and reports do not show up.

    That said, it sounds like you are opening images outside of Access, correct?  Please post the code you are using to do this.


    Miriam Bizup Access MVP

    Wednesday, April 4, 2018 9:48 AM
  • Hi Mr.Nghi,

    You had mentioned that,"when i open it by access 2016 it can not perform."

    Did you got any error? If yes, Let us know about that.

    I am using Access 2016 version below.

    I try to make a test with code below.

    Private Sub Command9_Click()
    Call Shell("RunDLL32.exe C:\Windows\SYSTEM32\shimgvw.dll,ImageView_Fullscreen C:\Users\v-padee\Desktop\mistique-blue-flower-background.jpg")
      
    
    End Sub

    I find that it is working fine on my side.

    I suggest you to make a test with this code and check the result.

    If your code has different logic then try to post your code. We will try to make a test with it to check the result.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 5, 2018 9:00 AM
    Moderator
  • Hi Guys

    The picture path is same between computer, not private driver. I don't know how to check the architecture of Access 2013 and 2016, 32-bit or 64-bit because it installed from IT team in my company. When it open by access 2016 it not alarm error, only can not display image as like access 2013. Here is my code:

    Function getFile(Tit As String, formatName As String, formatType As String)

    1. Module 1 for insert picture
    Dim dlgOpen As FileDialog
    Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
    With dlgOpen
    .Title = Tit
    .Filters.Clear
    .Filters.Add formatName, formatType
    .AllowMultiSelect = False
    result = .Show
    If (result <> 0) Then
    getFile = Trim(dlgOpen.SelectedItems.Item(1))
    End If
    End With

    End Function

    .................................................................................................

    2. module 2 for open picture

    Option Compare Database

    Option Explicit

    Public Const SW_HIDE = 0
    Public Const SW_NORMAL = 1
    Public Const SW_SHOWNORMAL = 1
    Public Const SW_SHOWMINIMIZED = 2
    Public Const SW_MAXIMIZE = 3
    Public Const SW_SHOWMAXIMIZED = 3
    Public Const SW_SHOWNOACTIVATE = 4
    Public Const SW_SHOW = 5
    Public Const SW_MINIMIZE = 6
    Public Const SW_SHOWMINNOACTIVE = 7
    Public Const SW_SHOWNA = 8
    Public Const SW_RESTORE = 9
    Public Const SW_MAX = 10
    Public Const SW_SHOWDEFAULT = 10



    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


    Public Function bimShellOpenFile(strFilePath As String, lngShowCmd As Long) As Long

    Dim r As Long
    Dim hwnd As Long

    r = ShellExecute(hwnd, "open", strFilePath, "", "", lngShowCmd)

    bimShellOpenFile = r

    End Function

    .................................................................................................................

    And code for Open button:

    Private Sub Command63_Click()
    Dim retval As Variant

    If Me.Txtpath1 > "" Then

        retval = bimShellOpenFile(Me.Txtpath1, vbNormalFocus) ' vbNormalFocus  True
    Else
       MsgBox "Link path not exit..."

    End If
    End Sub


    Note: all computers have access 2013 that can open it. but for access 2016 we can not open. But it can display on image frame on form
    • Edited by Nghi Trinh Friday, April 6, 2018 3:38 AM
    Friday, April 6, 2018 3:36 AM
  • Hi Mr.Nghi,

    Where do you give value to variable "hwnd"?

    Regards,

    Ashidacchi -- http://hokusosha.com/

    Friday, April 6, 2018 3:44 AM
  • Hi Mr.Nghi,

    I can see that you are passing vbNormalFocus as lngShowCmd.

    I try to check the parameters value and find that in other links they are using SW_SHOWNORMAL or numbers like 1 to pass its value.

    Try to replace it with vbNormalFocus to check whether it makes any difference or not.

    Reference:

    Shell.ShellExecute method

    ShellExecute function

    Also let us know, if you are getting any error.

    It will help us to narrow down the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 6, 2018 8:50 AM
    Moderator
  • hwnd [in, optional]

    Type: HWND

    A handle to the parent window used for displaying a UI or error messages. This value can be NULL if the operation is not associated with a window.

    Monday, April 9, 2018 4:21 AM
  • Can you show me how to replace SW_SHOWNORMAL by vbNormalFocus. That code i borrow from Forums.
    Monday, April 9, 2018 4:24 AM
  • Hi Mr.Nghi,

    You had mentioned that,"Can you show me how to replace SW_SHOWNORMAL by vbNormalFocus".

    You can just pass the numerical value for it. Below is an example for the same that I had tested with Access 2016.

    Public Declare Function ShellExecute _
        Lib "shell32.dll" _
        Alias "ShellExecuteA" ( _
        ByVal hwnd As Long, _
        ByVal lpOperation As String, _
        ByVal lpFile As String, _
        ByVal lpParameters As String, _
        ByVal lpDirectory As String, _
        ByVal nShowCmd As Long) _
        As Long
    
    
    
    Sub ShellExec()
        Dim strFile As String
        Dim strAction As String
        Dim lngErr As Long
    
        
        strFile = "C:\Users\v-padee\Desktop\IMG_20171003_160300.jpg"
        strAction = "OPEN"
    
        lngErr = ShellExecute(0, strAction, strFile, "", "", 0)
    
       
    
    End Sub
    
    

    You can directly try to run the example in Access. Replace the image path in the code before running the code.

    Check whether it is working or not.

    If that work correctly then try to implement it in your code.

    Let us know about the result, We will try to provide you further suggestions if needed.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 10, 2018 1:34 AM
    Moderator