I download files from my PC based cash register into an access application that I have developed everyday. The files are delimeted and have an extension that access does not recognise (.001). So I rename the file with a .txt extension. However, the files change names slightly eveyday. A file named Crday_25.001 will be named Crday_26.001 the next day. The name before the underscore as well as the extension remain constant. I am trying to refer to the changing part of the file name as a "wild card". I have tried the code below, but keep getting an error that says "can't find file" and high lites the last line. What am I doing wrong?
Private Sub Command1_Click()
Dim strFileName As String
strFileName = Dir$("C:\~Master Files\SSM\001\Crday_*.001"
If strFileName <> "" Then
Name "C:\~Master Files\SSM\" & strFileName As "C:\~Master _ Files\SSM\" & "Credit.txt"
End If
End Sub
I have also tried
Dim strFileName As String
strFileName = Dir$("C:\~Master Files\SSM\001\Crday_*.001"
If strFileName <> "" Then
Name strFileName As "Credit.txt"
End If
Private Sub Command1_Click()
Dim strFileName As String
strFileName = Dir$("C:\~Master Files\SSM\001\Crday_*.001"
If strFileName <> "" Then
Name "C:\~Master Files\SSM\" & strFileName As "C:\~Master _ Files\SSM\" & "Credit.txt"
End If
End Sub
I have also tried
Dim strFileName As String
strFileName = Dir$("C:\~Master Files\SSM\001\Crday_*.001"
If strFileName <> "" Then
Name strFileName As "Credit.txt"
End If