Question Error 53 : File Not Found (1 Viewer)

nur

New member
Local time
Today, 15:33
Joined
Sep 9, 2015
Messages
1
Hi and Good Day to all,

Before I start, I would like to inform to you guys that I am very very new to Microsoft Access. So, my question might be pretty easy to all.

I am working on Access project where there is a form where user will enter data into in. After complete for data entry, they will click Browse button to select file that they want to rename and to move. After they click Save button, the form will save all the data that the users had enters and it will rename and move the file location to a new location.

So, the problem is, there is an error showed saying "Error 53:File not found."
and it showed to this line of code Name Me.DisplayFileName As FileToSaveLocation. I am pretty sure sure that the file is on the location. I do not know what the problem is. Can anyone please help me with this? :/

this is my code for Browse:
Dim f As Object
Dim strFile As String
Dim strFolder As String
Dim varItem As Variant

Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
For Each varItem In f.SelectedItems
strFile = Dir(varItem)
strFolder = Left(varItem, Len(varItem) - Len(strFile))
MsgBox "Folder: " & strFolder & vbCrLf & _
"File: " & strFile
Me.DisplayFileName = strFolder & strFile
Next
End If
Set f = Nothing
End If

and this is the code for rename and move file

Dim FileToSaveLocation As String

If IsNull(DisplayFileName) Then
MsgBox "Please select file to save!", vbCritical 'check da plih file ke belum
Else

FileToSaveLocation = "C:\Users\User\Desktop\project\ET Report" & "\" & ReportNumber.Value & ".pdf"

Name Me.DisplayFileName As FileToSaveLocation


End If
 

llkhoutx

Registered User.
Local time
Today, 17:33
Joined
Feb 26, 2001
Messages
4,018
You code is for selecting multiple files. There code on this site doing what you want, i.e. selecting one file.

I found the following right away

Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = False
f.Show
MsgBox "file choosen = " & f.SelectedItems.Count

Those many "f" object properties which can me specified.

This should get you started.
 

Users who are viewing this thread

Top Bottom