Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    DzuB is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    12

    Run-time error 2114

    hi, I am a user of an Access database and not a programmer. I don't think I will be able to talk to the programmer who developed this database so I'm hoping someone may be able to guide me in the right direction. By the way, this database/entry form works fine on other people's computers. I am using Access 2010 with this database and have no trouble except in regards to attaching or associating pictures to/with this entry form. In order to select or add a picture to the entry form it brings up Windows Explorer. When I try to select a picture and open it, I get the following error message: Run-time error 2114. Microsoft Access doesn't support the format of the file C:\Zone one\Picture name.jpg or file is too large. Try converting the file to BMP format. The files are not too large and nobody converts their files to BPM format is using this entry form/database. There is an option to press debug. When I do I see the following highlighted: Let [Forms]![imageform]![Thumb1].Picture = [FileName1]
    Here is that line given a little more context where the line of code above appears at the bottom:
    Private Sub btnPickFile1_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName1 = TestIt()
    'strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
    'strInputFileName = ahtCommonFileOpenSave( _
    Filter:=strFilter, OpenFile:=True, _
    DialogTitle:="Please select an input file...", _
    Flags:=ahtOFN_HIDEREADONLY)
    'Note that in order to call the Save As dialog box, you can use the same wrapper function by just setting the OpenFile option as False. For example,



    'Ask for SaveFileName
    'strFilter = ahtAddFilterItem(myStrFilter, "Excel Files (*.xls)", "*.xls")
    'strSaveFileName = ahtCommonFileOpenSave( _
    OpenFile:=False, _
    Filter:=strFilter, _
    Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
    Let [Forms]![imageform]![Thumb1].Picture = [FileName1]
    End Sub



    Any Suggestions would be much appreciated!
    Thanks,
    John

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    I have never seen Let in any code. Remove it.

    I have never used Picture property to dynamically display images. VBA code setting Picture property was required pre-Access2007 (with mdb files). I use Image control's ControlSource property bound to field.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    DzuB is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    12
    Quote Originally Posted by June7 View Post
    I have never seen Let in any code. Remove it.

    I have never used Picture property to dynamically display images. VBA code setting Picture property was required pre-Access2007 (with mdb files). I use Image control's ControlSource property bound to field.
    Thanks for your reply June7, As I scanned the rest of this code I am seeing "Let" throughout. I'm sure this was written pre-Access 2007. I am hesitant to rewrite any code at this point. Do you think I would have better luck using an earlier version of access?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    How much earlier? I started with Access 2003 and have never seen Let in any code. I have seen Set.

    My recommendation is to use ControlSource property bound to field, if you are using Image control.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    DzuB is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    12
    Quote Originally Posted by June7 View Post
    How much earlier? I started with Access 2003 and have never seen Let in any code. I have seen Set.

    My recommendation is to use ControlSource property bound to field, if you are using Image control.
    I will try replacing let with set and see what happens. I must admit however that I don't understand the first thing about your recommendation to use control source property bound to field. I would like to but I don't know how much time that would be for you to explain?
    Thanks,
    John

  6. #6
    DzuB is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    12
    Quote Originally Posted by June7 View Post
    How much earlier? I started with Access 2003 and have never seen Let in any code. I have seen Set.

    My recommendation is to use ControlSource property bound to field, if you are using Image control.
    I tried changing every instance of Let to Set and now I'm getting runtime error 438. Object doesn't support this property or method. When I go to debug the same line of code is highlighted: Set [Forms]![imageform]![Thumb1].Picture = [FileName1]

    Here is all of the code if it helps.


    Option Compare Database
    Private Sub btnExit_Click()
    DoCmd.Close
    DoCmd.GoToControl "text3"
    End Sub
    Private Sub btnSubmitFile1_Click()
    If IsNull([FileName1]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
    Set FileNameOld = [FileName1]
    Set FileNameNew = Format([PolNo], "000000") & "_1.jpg"
    Set [FileName1] = Format([PolNo], "000000") & "_1.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile2_Click()
    If IsNull([FileName2]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
    Set FileNameOld = [FileName2]
    Set FileNameNew = Format([PolNo], "000000") & "_2.jpg"
    Set [FileName2] = Format([PolNo], "000000") & "_2.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile3_Click()
    If IsNull([FileName3]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
    Set FileNameOld = [FileName3]
    Set FileNameNew = Format([PolNo], "000000") & "_3.jpg"
    Set [FileName3] = Format([PolNo], "000000") & "_3.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile4_Click()
    If IsNull([FileName4]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
    Set FileNameOld = [FileName4]
    Set FileNameNew = Format([PolNo], "000000") & "_4.jpg"
    Set [FileName4] = Format([PolNo], "000000") & "_4.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile5_Click()
    If IsNull([FileName5]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
    Set FileNameOld = [FileName5]
    Set FileNameNew = Format([PolNo], "000000") & "_5.jpg"
    Set [FileName5] = Format([PolNo], "000000") & "_5.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile6_Click()
    If IsNull([FileName6]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
    Set FileNameOld = [FileName6]
    Set FileNameNew = Format([PolNo], "000000") & "_6.jpg"
    Set [FileName6] = Format([PolNo], "000000") & "_6.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile7_Click()
    If IsNull([FileName7]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
    Set FileNameOld = [FileName7]
    Set FileNameNew = Format([PolNo], "000000") & "_7.jpg"
    Set [FileName7] = Format([PolNo], "000000") & "_7.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile8_Click()
    If IsNull([FileName8]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
    Set FileNameOld = [FileName8]
    Set FileNameNew = Format([PolNo], "000000") & "_8.jpg"
    Set [FileName8] = Format([PolNo], "000000") & "_8.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile9_Click()
    If IsNull([FileName9]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
    Set FileNameOld = [FileName9]
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    If FileNameOld <> FileNameNew Then FileCopy FileNameOld, FileNameNew
    If FileNameOld <> FileNameNew Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile1_Click()
    Set [FileName1] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile2_Click()
    Set [FileName2] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile3_Click()
    Set [FileName3] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile4_Click()
    Set [FileName4] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile5_Click()
    Set [FileName5] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile6_Click()
    Set [FileName6] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile7_Click()
    Set [FileName7] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile8_Click()
    Set [FileName8] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile9_Click()
    Set [FileName9] = Null
    Call LoadThumbs
    End Sub
    Private Sub Form_Current()
    Call LoadThumbs
    End Sub
    Private Sub Form_Load()
    DoCmd.Maximize
    Dim MyPath
    MyPath = CurDir
    If LCase(Right(MyPath, 7)) <> "\tandem" Then
    MyPath = MyPath & "\tandem"
    ' MsgBox (MyPath)
    End If
    ChDir MyPath
    Call LoadThumbs
    End Sub
    Private Sub LoadThumbs()
    On Error Resume Next
    Set [Forms]![imageform]![Thumb1].Picture = none
    Set [Forms]![imageform]![Thumb2].Picture = none
    Set [Forms]![imageform]![Thumb3].Picture = none
    Set [Forms]![imageform]![Thumb4].Picture = none
    Set [Forms]![imageform]![Thumb5].Picture = none
    Set [Forms]![imageform]![Thumb6].Picture = none
    Set [Forms]![imageform]![Thumb7].Picture = none
    Set [Forms]![imageform]![Thumb8].Picture = none
    Set [Forms]![imageform]![Thumb9].Picture = none
    Set [Forms]![imageform]![Thumb1].Picture = [FileName1]
    Set [Forms]![imageform]![Thumb2].Picture = [FileName2]
    Set [Forms]![imageform]![Thumb3].Picture = [FileName3]
    Set [Forms]![imageform]![Thumb4].Picture = [FileName4]
    Set [Forms]![imageform]![Thumb5].Picture = [FileName5]
    Set [Forms]![imageform]![Thumb6].Picture = [FileName6]
    Set [Forms]![imageform]![Thumb7].Picture = [FileName7]
    Set [Forms]![imageform]![Thumb8].Picture = [FileName8]
    Set [Forms]![imageform]![Thumb9].Picture = [FileName9]
    End Sub
    Private Sub btnPickFile1_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName1 = TestIt()
    'strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
    'strInputFileName = ahtCommonFileOpenSave( _
    Filter:=strFilter, OpenFile:=True, _
    DialogTitle:="Please select an input file...", _
    Flags:=ahtOFN_HIDEREADONLY)
    'Note that in order to call the Save As dialog box, you can use the same wrapper function by just setting the OpenFile option as False. For example,

    'Ask for SaveFileName
    'strFilter = ahtAddFilterItem(myStrFilter, "Excel Files (*.xls)", "*.xls")
    'strSaveFileName = ahtCommonFileOpenSave( _
    OpenFile:=False, _
    Filter:=strFilter, _
    Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
    Set [Forms]![imageform]![Thumb1].Picture = [FileName1]
    End Sub
    Private Sub btnPickFile2_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName2 = TestIt()
    Let [Forms]![imageform]![Thumb2].Picture = [FileName2]
    End Sub
    Private Sub btnPickFile3_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName3 = TestIt()
    Let [Forms]![imageform]![Thumb3].Picture = [FileName3]
    End Sub
    Private Sub btnPickFile4_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName4 = TestIt()
    Let [Forms]![imageform]![Thumb4].Picture = [FileName4]
    End Sub
    Private Sub btnPickFile5_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName5 = TestIt()
    Let [Forms]![imageform]![Thumb5].Picture = [FileName5]
    End Sub
    Private Sub btnPickFile6_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName6 = TestIt()
    Let [Forms]![imageform]![Thumb6].Picture = [FileName6]
    End Sub
    Private Sub btnPickFile7_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName7 = TestIt()
    Let [Forms]![imageform]![Thumb7].Picture = [FileName7]
    End Sub
    Private Sub btnPickFile8_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName8 = TestIt()
    Set [Forms]![imageform]![Thumb8].Picture = [FileName8]
    End Sub
    Private Sub btnPickFile9_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName9 = TestIt()
    Set [Forms]![imageform]![Thumb9].Picture = [FileName9]
    End Sub
    Function TestIt() As String
    Dim strFilter As String
    Dim lngFlags As Long
    strFilter = ahtAddFilterItem(strFilter, "Image File (*.jpg)", "*.jpg")
    strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
    TestIt = ahtCommonFileOpenSave(InitialDir:="C:\SCWH\Zone1\T andeM", _
    Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
    DialogTitle:="Choose a file")
    ' Since you passed in a variable for lngFlags,
    ' the function places the output flags value in the variable.
    Debug.Print Hex(lngFlags)
    'MsgBox (TestIt())
    End Function
    Private Sub Thumb1_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName1]
    End Sub
    Private Sub Thumb2_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName2]
    End Sub
    Private Sub Thumb3_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName3]
    End Sub
    Private Sub Thumb4_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName4]
    End Sub
    Private Sub Thumb5_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName5]
    End Sub
    Private Sub Thumb6_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName6]
    End Sub
    Private Sub Thumb7_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName7]
    End Sub
    Private Sub Thumb8_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName8]
    End Sub
    Private Sub Thumb9_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName9]
    End Sub

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Are you using an Image control to display image type files (jpg, png, bmp, wim)?

    Image control has a ControlSource property, just like a textbox. This property can be set to a field of form/report RecordSource. If the field is a text type and it stores the filepath\filename of image file, Access will find and display image in the control. If field is an attachment type with embedded image files, the control will still display image.

    Regardless, should not need Set nor Let to set Picture property. Some of the code does not use Let/Set for the same command. Still see Let in there. Remove Set/Let.

    Please post lengthy code within CODE tags to retain indentation and readability. Use the # button on Editor toolbar.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    DzuB is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    12
    Quote Originally Posted by June7 View Post
    Are you using an Image control to display image type files (jpg, png, bmp, wim)?

    Image control has a ControlSource property, just like a textbox. This property can be set to a field of form/report RecordSource. If the field is a text type and it stores the filepath\filename of image file, Access will find and display image in the control. If field is an attachment type with embedded image files, the control will still display image.

    Regardless, should not need Set nor Let to set Picture property. Some of the code does not use Let/Set for the same command. Still see Let in there. Remove Set/Let.

    Please post lengthy code within CODE tags to retain indentation and readability. Use the # button on Editor toolbar.
    I removed all of the Sets and Lets. I am back to the original run time error: 2114. How can I find out if this database is using image control to display image type files(I didn't write it)? Thanks for the tip on using the toolbar to retain indentation.

    Code:
    Option Compare Database
    Private Sub btnExit_Click()
    DoCmd.Close
    DoCmd.GoToControl "text3"
    End Sub
    Private Sub btnSubmitFile1_Click()
    If IsNull([FileName1]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
     FileNameOld = [FileName1]
     FileNameNew = Format([PolNo], "000000") & "_1.jpg"
     [FileName1] = Format([PolNo], "000000") & "_1.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile2_Click()
    If IsNull([FileName2]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
     FileNameOld = [FileName2]
     FileNameNew = Format([PolNo], "000000") & "_2.jpg"
     [FileName2] = Format([PolNo], "000000") & "_2.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile3_Click()
    If IsNull([FileName3]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
     FileNameOld = [FileName3]
     FileNameNew = Format([PolNo], "000000") & "_3.jpg"
     [FileName3] = Format([PolNo], "000000") & "_3.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile4_Click()
    If IsNull([FileName4]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
     FileNameOld = [FileName4]
     FileNameNew = Format([PolNo], "000000") & "_4.jpg"
     [FileName4] = Format([PolNo], "000000") & "_4.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile5_Click()
    If IsNull([FileName5]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
     FileNameOld = [FileName5]
     FileNameNew = Format([PolNo], "000000") & "_5.jpg"
     [FileName5] = Format([PolNo], "000000") & "_5.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile6_Click()
    If IsNull([FileName6]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
     FileNameOld = [FileName6]
     FileNameNew = Format([PolNo], "000000") & "_6.jpg"
     [FileName6] = Format([PolNo], "000000") & "_6.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile7_Click()
    If IsNull([FileName7]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
     FileNameOld = [FileName7]
     FileNameNew = Format([PolNo], "000000") & "_7.jpg"
     [FileName7] = Format([PolNo], "000000") & "_7.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile8_Click()
    If IsNull([FileName8]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
     FileNameOld = [FileName8]
     FileNameNew = Format([PolNo], "000000") & "_8.jpg"
     [FileName8] = Format([PolNo], "000000") & "_8.jpg"
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnSubmitFile9_Click()
    If IsNull([FileName9]) = True Then Exit Sub
    Dim FileNameNew As String
    Dim FileNameOld As String
     FileNameOld = [FileName9]
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then FileCopy FileNameOld, FileNameNew
    If Right(FileNameOld, 12) <> Right(FileNameNew, 12) Then Kill (FileNameOld)
    If FileNameOld <> FileNameNew Then FileCopy FileNameOld, FileNameNew
    If FileNameOld <> FileNameNew Then Kill (FileNameOld)
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile1_Click()
     [FileName1] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile2_Click()
     [FileName2] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile3_Click()
     [FileName3] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile4_Click()
     [FileName4] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile5_Click()
     [FileName5] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile6_Click()
     [FileName6] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile7_Click()
     [FileName7] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile8_Click()
     [FileName8] = Null
    Call LoadThumbs
    End Sub
    Private Sub btnClearFile9_Click()
     [FileName9] = Null
    Call LoadThumbs
    End Sub
    Private Sub Form_Current()
    Call LoadThumbs
    End Sub
    Private Sub Form_Load()
    DoCmd.Maximize
    Dim MyPath
    MyPath = CurDir
    If LCase(Right(MyPath, 7)) <> "\tandem" Then
        MyPath = MyPath & "\tandem"
       ' MsgBox (MyPath)
    End If
    ChDir MyPath
    Call LoadThumbs
    End Sub
    Private Sub LoadThumbs()
    On Error Resume Next
     [Forms]![imageform]![Thumb1].Picture = none
     [Forms]![imageform]![Thumb2].Picture = none
     [Forms]![imageform]![Thumb3].Picture = none
     [Forms]![imageform]![Thumb4].Picture = none
     [Forms]![imageform]![Thumb5].Picture = none
     [Forms]![imageform]![Thumb6].Picture = none
     [Forms]![imageform]![Thumb7].Picture = none
     [Forms]![imageform]![Thumb8].Picture = none
     [Forms]![imageform]![Thumb9].Picture = none
     [Forms]![imageform]![Thumb1].Picture = [FileName1]
     [Forms]![imageform]![Thumb2].Picture = [FileName2]
     [Forms]![imageform]![Thumb3].Picture = [FileName3]
     [Forms]![imageform]![Thumb4].Picture = [FileName4]
     [Forms]![imageform]![Thumb5].Picture = [FileName5]
     [Forms]![imageform]![Thumb6].Picture = [FileName6]
     [Forms]![imageform]![Thumb7].Picture = [FileName7]
     [Forms]![imageform]![Thumb8].Picture = [FileName8]
     [Forms]![imageform]![Thumb9].Picture = [FileName9]
    End Sub
    Private Sub btnPickFile1_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName1 = TestIt()
    'strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
    'strInputFileName = ahtCommonFileOpenSave( _
                    Filter:=strFilter, OpenFile:=True, _
                    DialogTitle:="Please select an input file...", _
                    Flags:=ahtOFN_HIDEREADONLY)
    'Note that in order to call the Save As dialog box, you can use the same wrapper function by just ting the OpenFile option as False. For example,
    
    'Ask for SaveFileName
    'strFilter = ahtAddFilterItem(myStrFilter, "Excel Files (*.xls)", "*.xls")
    'strSaveFileName = ahtCommonFileOpenSave( _
                                        OpenFile:=False, _
                                        Filter:=strFilter, _
                        Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
     [Forms]![imageform]![Thumb1].Picture = [FileName1]
    End Sub
    Private Sub btnPickFile2_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName2 = TestIt()
     [Forms]![imageform]![Thumb2].Picture = [FileName2]
    End Sub
    Private Sub btnPickFile3_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName3 = TestIt()
     [Forms]![imageform]![Thumb3].Picture = [FileName3]
    End Sub
    Private Sub btnPickFile4_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName4 = TestIt()
     [Forms]![imageform]![Thumb4].Picture = [FileName4]
    End Sub
    Private Sub btnPickFile5_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName5 = TestIt()
     [Forms]![imageform]![Thumb5].Picture = [FileName5]
    End Sub
    Private Sub btnPickFile6_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName6 = TestIt()
     [Forms]![imageform]![Thumb6].Picture = [FileName6]
    End Sub
    Private Sub btnPickFile7_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName7 = TestIt()
     [Forms]![imageform]![Thumb7].Picture = [FileName7]
    End Sub
    Private Sub btnPickFile8_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName8 = TestIt()
     [Forms]![imageform]![Thumb8].Picture = [FileName8]
    End Sub
    Private Sub btnPickFile9_Click()
    Dim strFilter As String
    Dim strInputFileName As String
    Me.FileName9 = TestIt()
     [Forms]![imageform]![Thumb9].Picture = [FileName9]
    End Sub
    Function TestIt() As String
        Dim strFilter As String
        Dim lngFlags As Long
        strFilter = ahtAddFilterItem(strFilter, "Image File (*.jpg)", "*.jpg")
        strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
        TestIt = ahtCommonFileOpenSave(InitialDir:="C:\SCWH\Zone1\TandeM", _
            Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
            DialogTitle:="Choose a file")
        ' Since you passed in a variable for lngFlags,
        ' the function places the output flags value in the variable.
        Debug.Print Hex(lngFlags)
       'MsgBox (TestIt())
    End Function
    Private Sub Thumb1_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName1]
    End Sub
    Private Sub Thumb2_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName2]
    End Sub
    Private Sub Thumb3_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName3]
    End Sub
    Private Sub Thumb4_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName4]
    End Sub
    Private Sub Thumb5_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName5]
    End Sub
    Private Sub Thumb6_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName6]
    End Sub
    Private Sub Thumb7_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName7]
    End Sub
    Private Sub Thumb8_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName8]
    End Sub
    Private Sub Thumb9_Click()
    On Error Resume Next
    DoCmd.OpenForm "ImageBig"
    [Forms]![ImageBig]![ImageBigPic].Picture = [FileName9]
    End Sub

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Forms, Reports, Buttons, and ImageControl all have Picture property. Should be easy to tell which is which. An ImageControl has only 5 event procedures available.

    If you want to provide db for analysis, follow instructions at bottom of my post.

    I do find it odd that code works on other computers. What system are they running?

    If the issue is not use or nonuse of Let/Set, then may be in system setup. Memory allotment or something.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,861
    You need to declare Option Explicit at the top of your module.

    Code:
    Option Compare Database
    Option Explicit
    Does the code compile?

  11. #11
    DzuB is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    12
    Thanks I inserted the Option Explicit, Also I tried "compile inspect" and it gave me a compile error: Method or data member not found. It highlighted in blue - FileName1 in the line- Me.FileName1 = TestIt()

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    None of which explains why code runs successfully for other users. They are using the same database?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    DzuB is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    12
    I think one of the guys is running Windows 8 and the other may be running Windows 10. At least one of the versions of Access is 2007 and I'm still waiting to find out if anyone is using 2010. I have attempted to upload the DB
    Attached Files Attached Files

  14. #14
    DzuB is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    12
    Quote Originally Posted by June7 View Post
    None of which explains why code runs successfully for other users. They are using the same database?
    yeah everyone uses the same database

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    If the two linked tables are relevant to this issue, will have to provide them as well. Which objects are involved? What process do I follow to replicate the issue?

    The file is an mdb so that explains why using Picture property of Image controls. Think I found the form this concerns. Won't be simple to debug. Might have to dummy some image files and change paths in code. Take me a while.

    Or you could provide a zip file of images.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 01-04-2016, 09:40 AM
  2. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  3. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 PM

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