Skip to main content

ODBC Import with filename in a directory

Hi Brain, 
How are you? Is it possible to help me a second time :)
Thanks again for your answer on my previews question. I have a new one that is driving me bonkers!
I have got Visual FoxPro files that need to be imported so that i can join a couple of tables. Visual FoxPro Databases are controlled by a DBC file that changes every time. Importing is only possible with the ODBC connection and that is working perfectly.  
I have scripted the steps to import the tables and i am now trying to find the filename in the folder and include the filename and directory in the ODBC syntax. I am now stuck at the last step for the last couple of days and it is driving me crazy.
I reused some script on this website. 
I included the script with the lookup in the ODBC syntax for the directory and the filename. 
I icluded also the same script with fixed name in the ODBC syntax for the directory and the filename. 
 
The script can locate the filename that is being searched in the private function but i cant include it in the ODBC syntax like the sAdminpad
There is only 1 .DBC file in every folder.   
Can you see where it is going wrong?
 
Sorry for my poor scripting skills (i'm new to this)
 
Thanks in advance. 
 
Dino.