Link a new table by VBA

L

LittlePhil

Hi All,

I've looked for a long time and can't find any threads that help - maybe i'm
not using the correct terminology!

What i'm trying to do:
I'm trying to prompt a user to link a table.

Background:
Every month data is downloaded from an ODBC database - we use this "freeze"
for reporting for the whole month, then next month i need to relink the table.
.. problem is the table for next month is called something else.

My Strategy:
step 1) I was going to delete the outdated linked table with;
DoCmd.DeleteObject acTable, "MyLinkedTable"

step 2) Then open the link table dialogue box (you know when you hit RMB and
click "link tables..." NOT the link table manager!) to prompt the user for
the new linked table (stuck here).

step 3) Rename the newly linked table "MyLinkedTable" so all my queries and
forms and VBA work.

If you have any better ideas - i'm ready to listen! I've looked throught
http://www.mvps.org/access/tables/tbl0009.htm and the other pages that are
regularly recommended but they seem overly complicated for my simple purposes
and it looks like i need to know what the table is called in advance... i
need the user to browse for it.

Many thanks for reading hope you can help!!!
 
L

LittlePhil via AccessMonster.com

Thanks Tina,

I was hoping that there was a simple one liner that would get me what i
wanted, but it looks your link will do the trick just as well - just might
take me a little longer to understand the processes involved!

Thanks very mcu for your help!

Phil

you might take a look at the following link, the code there may be useful:
http://www.mvps.org/access/api/api0001.htm

hth
[quoted text clipped - 27 lines]
Many thanks for reading hope you can help!!!
 
T

tina

you're welcome, good luck with it. :)


LittlePhil via AccessMonster.com said:
Thanks Tina,

I was hoping that there was a simple one liner that would get me what i
wanted, but it looks your link will do the trick just as well - just might
take me a little longer to understand the processes involved!

Thanks very mcu for your help!

Phil

you might take a look at the following link, the code there may be useful:
http://www.mvps.org/access/api/api0001.htm

hth
[quoted text clipped - 27 lines]
Many thanks for reading hope you can help!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top