Experts:
I'd like to get some assistance with modying a table import routine using VBA (NOT a "stored procedure" under the *External Data* ribbon).
Attached zip file contains the following:
1. Subfolder "Import_Data" includes a source file "020_ImportFile_07" (which contains table [01_Table]). ** Please note that my actual file includes additional objects (e.g., form, modules, etc.)
2. DB "Import_With_Stored_Path" includes VBA to import table [01_Table] from file "020_ImportFile_07".
Current Process:
1. Open DB file "Import_With_Stored_Path"
2. Open form "F01_MainMenu" (in VBA design mode) and update **DoCmd.TransferDatabase acImport** to reflect your folder path.
3. Close/re-open form and click on command button "Import Table".
Current Challenge:
a. The last 2 digits (i.e., "07") in the filename "020_ImportFile_07" indicate the file's version... this version # will change over time.
b. So, once the filename changes from, e.g., "020_ImportFile_07" to "020_ImportFile_08", the import routine (in DB "Import_With_Stored_Path") no longer works.
My question:
How would I modify the following VBA (with proper syntax)... ?
... from:
Code:
DoCmd.TransferDatabase acImport, "Microsoft Access", "YOUR_FOLDER_PATH\020_ImportFile_07.accdb", acTable, "01_Table", "01_Table", False
... to:
Code:
DoCmd.TransferDatabase acImport, "Microsoft Access", "YOUR_FOLDER_PATH\020_ImportFile_*.accdb", acTable, "01_Table", "01_Table", False
That is, the wildcard of "_*" in the filename reference currently does NOT work in VBA. What's the correct syntax?
Thank you,
Tom