Results 1 to 2 of 2
  1. #1
    Robyn_P's Avatar
    Robyn_P is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2017
    Posts
    150

    Dir command throwing data missmatch error

    Hello,

    I was wondering if you can help. I have the following bit of code that has been working fine but is now throwing a datamismatch error on the Dir command in the FileCopy line. I've done a compact and repair on the database and I'm still getting the error any time. Can anyone suggest what is wrong and how to correct ir?

    Code:
            MsgBox "Please Select the PDF of the work plan for transfer to the review directory", vbOKOnly, "Select  File"
            Set f = Application.FileDialog(3)
            f.AllowMultiSelect = False
            f.Filters.Add "PDF", "*.pdf", 1
            f.Show
            
            ' Copy the file to the new directory
            For Each varitem In f.SelectedItems
                FileCopy varitem, dirPath & "\" & Dir(varitem)
                Set IPSitems = CurrentDb.OpenRecordset("SELECT * FROM tblIPS WHERE [Title]='" & Me.txtTitle & "'")
                IPSitems.Edit
                    IPSitems!FileSize = FileLen(varitem)
                IPSitems.Update
                IPSitems.Close
            Next
    DirPath is a string containing the path to copy to
    Last edited by Robyn_P; 06-27-2022 at 08:12 AM. Reason: Added extra information

  2. #2
    Robyn_P's Avatar
    Robyn_P is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2017
    Posts
    150
    Hi all,

    Found the problem. I'm changed the form from an Ubound form to a bound form and one of the fieldnames in the table is Dir (I know, I should and will change that).

    For now I've removed the reference to that field and the functionality is now working again.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. VBA custom function throwing overflow error
    By catluvr in forum Programming
    Replies: 7
    Last Post: 10-15-2020, 12:06 PM
  2. Run-Time Error data type missmatch
    By Misterpokey in forum Programming
    Replies: 6
    Last Post: 03-11-2020, 09:17 AM
  3. Error 13 (Type Missmatch) problem
    By sdel_nevo in forum Programming
    Replies: 4
    Last Post: 01-31-2016, 06:54 AM
  4. Replies: 3
    Last Post: 05-15-2015, 04:19 PM
  5. Replies: 3
    Last Post: 12-10-2013, 08:53 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