Help to import variable file with date in file name (1 Viewer)

lookforsmt

Registered User.
Local time
Today, 23:14
Joined
Dec 26, 2011
Messages
672
yes i have both the files in the folder. /nothing happens in the immediate window after hitting ?bothpaths
 

Isaac

Lifelong Learner
Local time
Today, 12:14
Joined
Mar 14, 2017
Messages
8,738
You must either have the folder path wrong, the files aren't there, or else the files are named differently than we discussed.
What are your two existing file names now?
You have to do it while the code is still in Break mode, with the yellow offending line of code highlighted..

I just tested my code again, it worked correctly. See the attached and pay close attention to the TestFunction sub and the comments.
Testing 20200702 find file_folder source.jpg


Testing 20200702 find file.jpg
 

Attachments

  • Testing 20200702_2.accdb
    356 KB · Views: 96

lookforsmt

Registered User.
Local time
Today, 23:14
Joined
Dec 26, 2011
Messages
672
files are correctly named, outwardsort_260520 & onussort_260520. not sure where i am making the mistake,

thankyou for you help. since i have your testing file, i will try and replicate my project in that and try to play it tomorrow morning.
 

Isaac

Lifelong Learner
Local time
Today, 12:14
Joined
Mar 14, 2017
Messages
8,738
files are correctly named, outwardsort_260520 & onussort_260520. not sure where i am making the mistake,
I think it might be a case sensitive comparison.

Try changing
If Left(fsoFile.Name, 11) = "OutwardSort" And (Len(fsoFile.Name) = 22) Then
to
If Left(lcase(fsoFile.Name), 11) = "outwardsort" And (Len(fsoFile.Name) = 22) Then

and
If Left(fsoFile.Name, 8) = "OnusSort" And (Len(fsoFile.Name) = 19) Then
to
If Left(lcase(fsoFile.Name), 8) = "onussort" And (Len(fsoFile.Name) = 19) Then
 

Micron

AWF VIP
Local time
Today, 15:14
Joined
Oct 20, 2018
Messages
3,476
@pisorsisaac@gmail.co - does your code allow for file path spaces? Maybe the OP's file path(s) has them.
Sorry, I didn't download or study the code; even then, I've not seen the problem path(s) either, but just trying to help.
 

Isaac

Lifelong Learner
Local time
Today, 12:14
Joined
Mar 14, 2017
Messages
8,738
Good thought, but when I tested mine it was with a folder with spaces in the name. Should work . I think the latest problem was with the case sensitive comparison
 

Micron

AWF VIP
Local time
Today, 15:14
Joined
Oct 20, 2018
Messages
3,476
That would mean OP has set db Option Compare as "Binary" or has no setting?
(defaults to Binary if not set)
 

Isaac

Lifelong Learner
Local time
Today, 12:14
Joined
Mar 14, 2017
Messages
8,738
Yes I believe you're right. I didn't want to suggest he change it to option compare text, I figured the less "sweeping" solution would just be the lower case conversion that I recently posted. That way it doesn't mess up anything else they already have going.
I should have caught that issue earlier when I was posting my code at first but I guess I took the requirements bit too literally
 

Users who are viewing this thread

Top Bottom