RunCommand acCmdLinkTables Fails in Access 2007 (Error 2046)
RunCommand acCmdLinkTables Fails in Access 2007 (Error 2046)
am 10.01.2008 23:21:45 von tony.abbitt
I have recently installed Office 2007 (SP1) retaining the previous
installation of Office 2003.
I have converted an Access 2003 database to Access 2007. The database
contains the VBA code 'DoCmd.RunCommand acCmdLinkTables' to initiate
the dialog box to rebuild links to tables held in a back-end Access
database (which has also been converted from Access 2003 to Access
2007).
The code runs without problem in the original Access 2003 .mdb format
under Access 2003, yet when run in either Access 2003 .mdb format or
Access 2007 .accdb format under Access 2007 returns error 2046 with
the description 'The command or action 'LinkTables' isn't available
now.'
Refreshing the table links 'manually' in Access 2007 via the Ribbon
(External Data / Access) runs without error.
Any ideas welcomed!
Thanks, Tony.
Re: RunCommand acCmdLinkTables Fails in Access 2007 (Error 2046)
am 11.01.2008 05:26:06 von Allen Browne
Does this do what you expect:
RunCommand acCmdLinkedTableManager
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
wrote in message
news:d97d4379-511e-42f3-a565-229cfe2790c9@j78g2000hsd.google groups.com...
>I have recently installed Office 2007 (SP1) retaining the previous
> installation of Office 2003.
>
> I have converted an Access 2003 database to Access 2007. The database
> contains the VBA code 'DoCmd.RunCommand acCmdLinkTables' to initiate
> the dialog box to rebuild links to tables held in a back-end Access
> database (which has also been converted from Access 2003 to Access
> 2007).
>
> The code runs without problem in the original Access 2003 .mdb format
> under Access 2003, yet when run in either Access 2003 .mdb format or
> Access 2007 .accdb format under Access 2007 returns error 2046 with
> the description 'The command or action 'LinkTables' isn't available
> now.'
>
> Refreshing the table links 'manually' in Access 2007 via the Ribbon
> (External Data / Access) runs without error.
>
> Any ideas welcomed!
>
> Thanks, Tony
Re: RunCommand acCmdLinkTables Fails in Access 2007 (Error 2046)
am 11.01.2008 11:34:46 von tony.abbitt
On 11 Jan, 04:26, "Allen Browne" wrote:
> Does this do what you expect:
> =A0 =A0 RunCommand acCmdLinkedTableManager
>
> --
> Allen Browne - Microsoft MVP. =A0Perth, Western Australia
> Tips for Access users -http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> wrote in message
>
> news:d97d4379-511e-42f3-a565-229cfe2790c9@j78g2000hsd.google groups.com...
>
>
>
> >I have recently installed Office 2007 (SP1) retaining the previous
> > installation of Office 2003.
>
> > I have converted an Access 2003 database to Access 2007. =A0The database=
> > contains the VBA code 'DoCmd.RunCommand acCmdLinkTables' =A0to initiate
> > the dialog box to rebuild links to tables held in a back-end Access
> > database (which has also been converted from Access 2003 to Access
> > 2007).
>
> > The code runs without problem in the original Access 2003 .mdb format
> > under Access 2003, yet when run in either Access 2003 .mdb format or
> > Access 2007 .accdb format under Access 2007 returns error 2046 with
> > the description 'The command or action 'LinkTables' isn't available
> > now.'
>
> > Refreshing the table links 'manually' in Access 2007 via the Ribbon
> > (External Data / Access) runs without error.
>
> > Any ideas welcomed!
>
> > Thanks, Tony- Hide quoted text -
>
> - Show quoted text -
Thank you for your rapid response, Allen.
I have tried your suggestion and get a similar error, namely:
Error 2046: The command or action 'LinkedTableManager' isn't
available now.
Regards, Tony.
Re: RunCommand acCmdLinkTables Fails in Access 2007 (Error 2046)
am 11.01.2008 15:54:01 von Allen Browne
Tony, I've tried it with both MDB and ACCDB.
Works fine.
Are you sure there are any linked tables in this database?
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Tony" wrote in message
news:ae0731b9-e42b-48d1-ab40-24f45cca4dc6@c4g2000hsg.googleg roups.com...
On 11 Jan, 04:26, "Allen Browne" wrote:
> Does this do what you expect:
> RunCommand acCmdLinkedTableManager
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users -http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> wrote in message
>
> news:d97d4379-511e-42f3-a565-229cfe2790c9@j78g2000hsd.google groups.com...
>
>
>
> >I have recently installed Office 2007 (SP1) retaining the previous
> > installation of Office 2003.
>
> > I have converted an Access 2003 database to Access 2007. The database
> > contains the VBA code 'DoCmd.RunCommand acCmdLinkTables' to initiate
> > the dialog box to rebuild links to tables held in a back-end Access
> > database (which has also been converted from Access 2003 to Access
> > 2007).
>
> > The code runs without problem in the original Access 2003 .mdb format
> > under Access 2003, yet when run in either Access 2003 .mdb format or
> > Access 2007 .accdb format under Access 2007 returns error 2046 with
> > the description 'The command or action 'LinkTables' isn't available
> > now.'
>
> > Refreshing the table links 'manually' in Access 2007 via the Ribbon
> > (External Data / Access) runs without error.
>
> > Any ideas welcomed!
>
> > Thanks, Tony- Hide quoted text -
>
> - Show quoted text -
Thank you for your rapid response, Allen.
I have tried your suggestion and get a similar error, namely:
Error 2046: The command or action 'LinkedTableManager' isn't
available now.
Regards, Tony.
Re: RunCommand acCmdLinkTables Fails in Access 2007 (Error 2046)
am 11.01.2008 22:18:22 von tony.abbitt
On 11 Jan, 14:54, "Allen Browne" wrote:
> Tony, I've tried it with both MDB and ACCDB.
> Works fine.
>
> Are you sure there are any linked tables in this database?
>
> --
> Allen Browne - Microsoft MVP. =A0Perth, Western Australia
> Tips for Access users -http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Tony" wrote in message
>
> news:ae0731b9-e42b-48d1-ab40-24f45cca4dc6@c4g2000hsg.googleg roups.com...
> On 11 Jan, 04:26, "Allen Browne" wrote:
>
>
>
>
>
> > Does this do what you expect:
> > RunCommand acCmdLinkedTableManager
>
> > --
> > Allen Browne - Microsoft MVP. Perth, Western Australia
> > Tips for Access users -http://allenbrowne.com/tips.html
> > Reply to group, rather than allenbrowne at mvps dot org.
>
> > wrote in message
>
> >news:d97d4379-511e-42f3-a565-229cfe2790c9@j78g2000hsd.googl egroups.com...=
>
> > >I have recently installed Office 2007 (SP1) retaining the previous
> > > installation of Office 2003.
>
> > > I have converted an Access 2003 database to Access 2007. The database
> > > contains the VBA code 'DoCmd.RunCommand acCmdLinkTables' to initiate
> > > the dialog box to rebuild links to tables held in a back-end Access
> > > database (which has also been converted from Access 2003 to Access
> > > 2007).
>
> > > The code runs without problem in the original Access 2003 .mdb format
> > > under Access 2003, yet when run in either Access 2003 .mdb format or
> > > Access 2007 .accdb format under Access 2007 returns error 2046 with
> > > the description 'The command or action 'LinkTables' isn't available
> > > now.'
>
> > > Refreshing the table links 'manually' in Access 2007 via the Ribbon
> > > (External Data / Access) runs without error.
>
> > > Any ideas welcomed!
>
> > > Thanks, Tony- Hide quoted text -
>
> > - Show quoted text -
>
> Thank you for your rapid response, Allen.
>
> I have tried your suggestion and get a similar error, namely:
>
> Error 2046: =A0The command or action 'LinkedTableManager' isn't
> available now.
>
> Regards, Tony.- Hide quoted text -
>
> - Show quoted text -
Allen,
I wasn't thinking when I tried your LinkedTableManager suggestion. At
that time there were no linked tables in the front-end database as
they had all been deleted in preparation for a total refresh by using
LinkTables.
I have now 'manually' linked the required tables using the Ribbon/
External Data/Access and run the following 2 commands.
RunCommand acCmdLinkedTableManager
RunCommand acCmdLinkTables
The LinkedTableManager operates as expected by verifying that all
links are OK. The LinkTables then fails with error 2046 'The command
or action 'LinkTables' isn't available now'.
My objective with this code is to support the roll-out of a new
version of the front-end database. As part of the release procedures
all linked tables in the new front-end database are programatically
deleted and then refreshed from the back-end database.
Thanks for your ongoing help in this matter.
Regards, Tony.
Re: RunCommand acCmdLinkTables Fails in Access 2007 (Error 2046)
am 12.01.2008 02:48:53 von Allen Browne
Okay, it's easy enough to programmatically check the link works in your
initialization code. If not, pop up the File Open dialog to ask the user
where the back end has gone.
Microsoft had some example code in solutions.mdb:
http://support.microsoft.com/kb/248674
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
==============================
"Tony" replied in message
news:104c290d-653a-4c75-a2a6-d789c8792503@k2g2000hse.googleg roups.com...
Allen,
I wasn't thinking when I tried your LinkedTableManager suggestion. At
that time there were no linked tables in the front-end database as
they had all been deleted in preparation for a total refresh by using
LinkTables.
I have now 'manually' linked the required tables using the Ribbon/
External Data/Access and run the following 2 commands.
RunCommand acCmdLinkedTableManager
RunCommand acCmdLinkTables
The LinkedTableManager operates as expected by verifying that all
links are OK. The LinkTables then fails with error 2046 'The command
or action 'LinkTables' isn't available now'.
My objective with this code is to support the roll-out of a new
version of the front-end database. As part of the release procedures
all linked tables in the new front-end database are programatically
deleted and then refreshed from the back-end database.
Thanks for your ongoing help in this matter.
Regards, Tony.
Re: RunCommand acCmdLinkTables Fails in Access 2007 (Error 2046)
am 13.01.2008 18:04:59 von tony.abbitt
On 12 Jan, 01:48, "Allen Browne" wrote:
> Okay, it's easy enough to programmatically check the link works in your
> initialization code. If not, pop up the File Open dialog to ask the user
> where the back end has gone.
>
> Microsoft had some example code in solutions.mdb:
> =A0 =A0http://support.microsoft.com/kb/248674
>
> --
> Allen Browne - Microsoft MVP. =A0Perth, Western Australia
> Tips for Access users -http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> ==================== =====
======
> "Tony" replied in messagenews:104c290d-653a-4c75=
-a2a6-d789c8792503@k2g2000hse.googlegroups.com...
>
> Allen,
>
> I wasn't thinking when I tried your LinkedTableManager suggestion. =A0At
> that time there were no linked tables in the front-end database as
> they had all been deleted in preparation for a total refresh by using
> LinkTables.
>
> I have now 'manually' linked the required tables using the Ribbon/
> External Data/Access and run the following 2 commands.
>
> RunCommand acCmdLinkedTableManager
> RunCommand acCmdLinkTables
>
> The LinkedTableManager operates as expected by verifying that all
> links are OK. =A0The LinkTables then fails with error 2046 'The command
> or action 'LinkTables' isn't available now'.
>
> My objective with this code is to support the roll-out of a new
> version of the front-end database. =A0As part of the release procedures
> all linked tables in the new front-end database are programatically
> deleted and then refreshed from the back-end database.
>
> Thanks for your ongoing help in this matter.
>
> Regards, Tony.
Allen,
Thank you for your suggestion. However it doesn't fully achieve my
objective as, although existing links would be refreshed, any links
required to new tables in the back-end datasbase would not be
created. This additional functionality was an integral part of the
LinkTables command.
I have persevered over the weekend have now successfully resolved the
issue. Quite simply, the LinkTables command appears to have been
replaced by ImportAttachAccess. The code 'DoCmd.RunCommand
acCmdImportAttachAccess' exactly mimics the 'manual' approach using
Ribbon / External Data / Access and achieves my objectives precisely.
Thank you again for your help over the last few days.
Regards, Tony.