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
 

Some videos you may like

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
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
 

davidpayten

Board Regular
Joined
May 24, 2004
Messages
225
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
 

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
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
 

davidpayten

Board Regular
Joined
May 24, 2004
Messages
225
Hi,

Thanks for your SydneyGeek. Will give that a try and let you know how I go.

Cheers

Dave
 

Watch MrExcel Video

Forum statistics

Threads
1,122,491
Messages
5,596,462
Members
414,069
Latest member
StudExcel

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
Top