Link Tables and Select Link

A

Anna

Hi:

I was linking tables from another Access db in 2003 as follows:

DoCmd.RunCommand acCmdLinkTables
It was allowing user to select db and select tables to link

In Access 2007 this comand does not work and I replaced it with:

DoCmd.RunCommand acCmdImportAttachAccess
A dialog box allows to select table but then it gives 2 options:
CheckBox 1 Import tables, queries, form..
ChekcBox 2 Link to the datea source by creating a linked table

Check box 1 is a default. How can I either have CheckedBox2 show as
selected or link without using this dialog box.

I am afraid that user will be selecting Checkbox1

Can you help?

Anna




It works but it shows users a dialog with two options (first marked as
default)





Private Sub LinkTables()
On Error GoTo Err_Exit_Click
MsgBox "Files will be exported to
Table1\RmsInventoryTransfers\ExportGenesis\CurrentFiles\", , "Destination
Path"
MsgBox "Select external database and SELECT ALL tables option", ,
"Select Tables"
'DoCmd.RunCommand acCmdLinkTables
DoCmd.RunCommand acCmdImportAttachAccess
'MsgBox Err.Description
MsgBox "Operation Completed", , "Operation Status"
On Error GoTo Err_Exit_Click
ExportFiles
 
D

Daniel Pineault

Anna,

If you wish to have more control over the process then you have to develop
your own relinking code (and forms if required).

But why would your users be performing relinking? This should be automated
and transparent to them.

There are numerous examples of how you can automatically relink tables at
run-time. See (to name but 2 examples):

http://www.mvps.org/access/tables/tbl0009.htm
http://www.rogersaccesslibrary.com/forum/topic286.html
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
A

Anna

Hi Daniel:

Thanks for your response. I need user to select database and those dbs
change names and reside in various locactions. In 2003 it was working ok
with the

'DoCmd.RunCommand acCmdLinkTables

In 2007 i use
DoCmd.RunCommand acCmdImportAttachAccess

which does the same thing but shows additional dialog box for choosing
either import or link table, import as default. I am looking for the same
behaviour as it was with acCmdLinkTables in 2003.
 

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