It works, but:
1) It returns error (... can not open file ... It is already opened exclusively ...) whenever the Foxpro table is in use. But those tables are in use most of time;
2) It doesn't overwrite old table, imported earlier, but greates a new table every time. I.e. I have imported dable MyTable, and after running the procedure I have MyTable and MyTable1, and have to rename MyTable1 to MyTable;
3) One of source tables has some memo fields (in FoxPro, memo field contains link to special memo table). The procedure returns an error every time when querying it;
4) The procedure above does import complete tables. I don't need most of fields in my application at all, and from some tables I want only data, for which certain conditions are met.
I can easily create an ODBC query in Excel (using ODBC driver for VisualFox Tables), which is doing much better. I tried to make the same thing in Access VBA, but I get only confused. And all examples I did find, were about importing from another mdb, or the code was in VB.
I hope for some good advice here. And maybe QueryTable properties for my Excel query are useful: