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