I am trying to use Access VBA to automate the import (by the push of a button) of daily files that exist in a format like this:
Final_Data_ver20181101063035.xlsx
where the numeric piece translates as: yyyymmddhhmmss.
However, without knowing exactly what time the file was created, Access can't find it. I've been trying something like:
Dim datepiece as String
Dim file as String
datepiece = format(Date,"yyyymmdd")
file = "c:\Users\brian\Final_Data_ver" & datepiece & "*" & ".xlsx"
But I keep getting errors when I try this. It's looking for a file literally named:
Final_Data_ver20181102*.xlsx
Maybe I'm just not able to use wildcards in a statement like this. Any help would be appreciated.
Thanks!