Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-21-2019, 11:19 PM   #1
AliyuKatsina
Newly Registered User
 
Join Date: Dec 2009
Posts: 73
Thanks: 1
Thanked 1 Time in 1 Post
AliyuKatsina is on a distinguished road
Convert sharepoint linked table to local table

Hi,

I wish to convert an imported sharepoint list to local table via vba.

the import is successful, however converting the list to a local table is my headache.


This is the code I used:

DoCmd.TransferDatabase acImport, "Microsoft Access", FPath, acTable, "SchoolList", "AccessTbl", 0

DoCmd.SelectObject acTable, "AccessTbl", True

RunCommand acCmdConvertLinkedTableToLocal

I got Error message no 2046 that the command ConvertLinkedTableToLocal is not available now! Please what is available now to accomplish the same task?

AliyuKatsina is offline   Reply With Quote
Old 07-21-2019, 11:30 PM   #2
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,757
Thanks: 107
Thanked 2,641 Times in 2,417 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Convert sharepoint linked table to local table

I've never worked with Sharepoint.

However, the first line of your code imports tables as local anyway
So the other two lines are I believe redundant and are I think the cause of your error
This should be all you need:
Code:
DoCmd.TransferDatabase acImport, "Microsoft Access", FPath, acTable, "SchoolList", "AccessTbl", 0
To link to an external table, use acLink rather than acImport
Then the other two lines will convert it to local without error.
Code:
DoCmd.TransferDatabase acLink, "Microsoft Access", FPath, acTable, "SchoolList", "AccessTbl", 0

DoCmd.SelectObject acTable, "AccessTbl", True

DoCmd.RunCommand acCmdConvertLinkedTableToLocal
The simplest way of converting linked to local involves no VBA.
Right click on the table in the nav pane and click 'Convert to Local Table'.
Just make sure the table isn't in use when you do so
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by isladogs; 07-22-2019 at 12:01 AM.
isladogs is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert sharepoint linked table to local table AliyuKatsina Modules & VBA 3 09-20-2018 07:34 AM
[SOLVED] Unable to convert a split table back to local table maheshashish Tables 14 02-25-2017 10:15 AM
Change Local Table to Sharepoint table JamesN Tables 4 08-05-2016 02:27 PM
Use VB to mMake a local copy of a Sharepoint linked table crissyjo1 Modules & VBA 6 08-08-2011 12:12 PM
Picking specific fields from a linked table to update a local table jonathanchye General 5 05-05-2011 04:28 AM




All times are GMT -8. The time now is 06:45 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World