Pass through query to linked table

davidpayten

Board Regular
Joined
May 24, 2004
Messages
225
Hi All,

I am using a BI tool to update data in a database via an ODBC connection into Access.
The problem is that I am trying to link to a linked table. Each time I link to it the data doesnot change unless I update the table.

So the question is: "Is it possible to create a query that links to the a "Linked table" and refreshes it?? the table links of a txt file.

Any help would be much appreciated.

Cheers

Dave
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Pass through queries are by definition, read-only. I used them extensively for a system I built where Access was the middleware between 2 SQL-based systems. In that circumstance Pass-through was fine. If you want read-write you need to link the tables via ODBC.

Denis
 
Upvote 0
Hi there,

we have the ODBC connection setup to pull from Access query, and points to the "Linked table". When a new text file is dropped into the directory where the linked table looks to grab the data, it does not update and the numbers ( ie it does not refresh - i need to refresh it each time and there appears not to be a macro that does the job for me).

When I refresh the link it works, but would like this to automatically refresh the table when I access it when I open / access it via ODBC.

Any ideas?

Cheers

Dave
 
Upvote 0
When the database opens...

Code:
Dim tdf As DAO.TableDef
Dim dbs As DAO.Database

Set dbs = CurrentDb()
For Each tdf In dbs.TableDefs
   If Len(tdf.Connect) > 0 Then
      tdf.RefreshLink
   End If
Next tdf

Set dbs = Nothing

Code like that could be put into the Open event of the first form that opens in the database. Alternatively, you could place that in a module (as a Function) and call that function when the database opens, using the autoexec macro.

Denis
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top