Update an Access linked table to use a UNC path - ms-access

I have an Access 2010 database A.mdb with a list of tables, one of which is a linked table, linked from another Access database B.mdb on the same server. These databases are on a development machine xxx.xxx.xxx.xxx, which is mapped on my computer as R://, and they are afterwards published online on a yyy.yyy.yyy.yyy server.
If I want to work on the database locally, I need to change the link to the table. But if I change it via filesystem (using the "Linked Table Manager"), the link becomes R://.... and when I look at the ASP page that requests those data, it is broken because the path is wrong. Also, if I change the link locally, it won't work on the online server.
Is there a way to change the link "programmatically"? That is, without using the Linked Table Manager?
I searched for an answer, but I am not that expert, I just understood that I have to write a "Module"? "Macro"?

Table links can be UNC paths. For example, say I have a linked table pointing to a database on \\192.168.1.2\Public\ which is mapped to drive P:. If I launch the VBA editor (Alt+F11), open the Immediate Window (Ctrl+G) and type...
?CurrentDB.TableDefs("remoteTable").Connect
...it will return...
;DATABASE=P:\B.accdb
...because I pointed to drive P: when I created the link.
Now if I create and run the VBA function...
Function linkToUnc()
Dim cdb As DAO.Database
Set cdb = CurrentDb
cdb.TableDefs("remoteTable").Connect = ";DATABASE=\\192.168.1.2\Public\B.accdb"
cdb.TableDefs("remoteTable").RefreshLink
Set cdb = Nothing
End Function
...the link is now a UNC path.
By the way, you can create UNC links in the Linked Table Manager if you browse to "Network", "machine name", "share name", but that will give you the machine name (in my case \\PICO\Public\B.accdb).

you can right click a linked table and select Linked table Manager. Select the linked table you want to work on and tic the checkbox bellow the window which says Always prompt for new location and click the OK button.
You will be asked for the new location. Browse and select the file and click OK.

I like to set up a File DSN on a shared folder accessible with read-access to our entire network and then use a linked table manager to the UNC path. To do this, I use the linked table manager and set up a file DSN on my desktop. I then copy and move the DSN file to the shared UNC directory. Then, I go into Access and delete the linked Table and recreate the linked table. To do this, after deleting the linked table, I do the following:
I click on ODBC Database-->Link to the data source by creating a linked table-->OK.
Click the File Data Source Tab in the Select Data Source Window. At the bottom of the dialogue box, you will see "DSN Name:" followed by a text box and a New Button. You will enter the entire UNC path AND filename into that text box (so this is pointing to the file you copied out to the UNC path). For example, I enter, \ATD-SERVER1\AccessShare\ContactsApp.accdb.dsn. Then click OK.
Assuming you have access permissions to server you are linking to, the Link Tables dialogue box will be displayed and you can then select your linked tables from there! Microsoft couldn't make this any less intuitive if they tried.

Related

Change path to database in Microsoft Access 2013

I need to make something in the database. It was saved as .accdb files. I copied this from my workplace and now I want to edit it on my home computer, but when I've open these files and tried to see already made commands I got an error message that I have not a valid path. This error occurs while I want to open command forms for adding and deleting, which need to use other databases.
How can I change the path so my Access will know, where these files are stored on my computer?
Go to band option (Database) Tools.
Select Linked Table Manager (label is localized).
Mark the checkbox down-left: Always as for new location.
Click Mark All, then OK.
Input the folder name where the data file exists.

Alter schema of Access 2013 database with linked table

I'm trying to change the schema of an Access 2013 table. I want to lengthen some of the text fields. When I change the schema and try to save I get dialog with Operation is not supported for this type of object, and a note that This property cannot be modified in linked tables. That makes sense. So I go to the relationships and try to delete one of the links. This gives me the error: You can't delete a relationship inherited from a linked database.
I don't know of any "linked databases" (I didn't create the database). Is there a way I can figure out what/where these might be?
Examine the TableDef properties for your linked table.
Here is an Immediate window session which examines properties for a linked table named remote_Foo:
' Connect identifies the database source of the linked table
? CurrentDb.TableDefs("remote_Foo").Connect
;DATABASE=C:\share\Access\BigDb_secure.mdb
' SourceTableName is the remote table name
? CurrentDb.TableDefs("remote_Foo").SourceTableName
tblFoo
You can use Ctrl+g to go to the Immediate window.
In Access 2010, that information is also available from the Linked Table Manager, which can be opened by right-clicking a link name in the Navigation pane and then choosing it from the shortcut menu. I don't know whether that option has changed in Access 2013.
You will need to make your design changes on the table in the remote database. Then recreate the link or use its RefreshLink method so that Access will recognize the design change and update the metadata it maintains for that link.
Your Table must be linked to Sharepoint site.
Go to "External Data" field and click "Work Offline" button (its a toggle button).
Make any schema changes.
Click again work online tab to sync changes to sharepoint.

Hide MS ACCESS DB FILE

I am currently using an access DB with front and back end. When I want to allow new users to access the DB I add the user to the folder in which the DB is housed. Essentially if they determined the path of the DB they could copy it ect.
Is there anyway to still allow access to the DB through the Access front end yet still prevent the user from actually getting to the directory of the file.
Thanks in advance for all your help.
No there isn't access is a file based dbms. For the app the user is running as to see the file, the user has to be able to.
This is the sort of need that says access cannot be used. Well not directly , you could use access as a backend, ie you park it behind some sort of service and your front end hits that.
yo keep an integral copy for you in case of changes then with the pblic copy, for example
with Access 2007 you click files -> Options -> active data base -> Navigation Options.
then you hide all the elements...

Change query file path in microsoft access

I am working with Access 2003 and I need to change the filepath for a Query. I am working on a database that I did not create and basically my workflow is using Excel to populate a list (file names and info about photos)
Then I go back to Access and in Query's I have an option for "Append Results" which will update my database with my new information that has been loaded into Excel.
I get an error saying that the filepath is wrong. I know the correct filepath and this is a correct error, I just can't find where to update the query so I can change the filepath. I did a couple of googles and used microsoft help but figured it might be faster to ask in here.
Thank you,
JWV
It sounds like the workbook is linked to Access as a linked table. Sort your objects by type, and try and open each linked table until one fails. Then drop the link, and re-create it to the correct spreadsheet with the same table name.
To do this, you first backup the *.mdb (in case you get it wrong) and then just delete the link, like you would delete a table. Next you need to right Click on any table => Import Spreadsheet => Go to your spreadsheet and untick the box that says 'Import into database' (or something similar, I don't have access to Access (ha!) at the minute to test), this will give you a link to the spreadsheet, as opposed to actually copying it as a table, then rename it so it is the same name as the original link.
I guess as an alternative you could remap the drives so that, on machines where this needs to run, the old I: drive is mapped back to I:, and the same for H:.

Query after splitting access database

I have splitted my ms access mdb file into front end and backend
Now i have the backend in the shared folder and frontends in users PC
i havent specified the network path anywhere in the front end to push data to the backend file
Could anyone tell me where i have to specify network path ???
Jaison,
Look at this answer to this question that tells how to split the database...including how to re-link the tables.
Creating the Front End MDE
Seth
Open the front end file. Right click on any table in the database viewer. Pick "Linked Table Manager." Highlight the tables you want to relink. Make sure to check the "always ask" checkbox at the bottom of the window.
The network path is in the linked table properties.
You have defined it when linking the table.
From the front-end, open the linked table in design view and get the properties window.
The path is displayed in the description, like
DATABASE=I:\ifs\xxx_be.mdb;TABLE=Valuation