Automatic Refresh of Linked Tables - ODBC Connection

fadilrexhepi

Registered User.
Local time
Today, 13:52
Joined
Feb 10, 2015
Messages
16
Hi,

I understand this information is like bread and butter (basics) for some, but I don't want to make any mistakes so I'd rather ask for support and thank you in advance for your time.

I have linked tables from SQL Server using ODBC connection that their location never changes. I have used certain fields of those tables to create queries and make table queries to derive to the information I needed (all this is done thanks to the help I have been getting from this website).
On these tables on SQL Server, there is new data added daily. Every day, midnight, there's new data records added of whatever transactions took place in that working day.
My question is, how often do I need to refresh linked tables in this case to get the latest data added. I mean, once I am linked, the make table query using those defined fields, would it get the latest data added by default when the query is executed, or I must refresh linked tables using Linked Table Manager and then run make table query.

Also, if I want the access to automatically refresh linked tables, can I use the following code? I have added this code, and executing it through a button, but I don't see anything happen, the database becomes inactive for couple seconds (I guess while it is updating) but I don't know is it updating the tables for sure or not, though I am not receiving any error when executing the code through the button.

Function RefreshLinkedTables()

Dim tdf As TableDef
For Each tdf In CurrentDb.TableDefs
If Len(tdf.Connect) > 0 Then
tdf.RefreshLink
End If
Next tdf

End Function


Thank you,
Fadil
 
Don't bother relinking tables. That doesn't refresh the data within the tables.

Assuming that it works the same way for SQL Server that it does with an Access database (may not be a good assumption). If I want my data refreshed within a form (using the sort button on the ribbon), I simply sort any field and it forces Access to reread the data. Or if you close and open a form, the data is reread from the database.
 
In your scenario you only need to refresh links if you change the design of the table in SQL. Data is automatically re-queried.
 

Users who are viewing this thread

Back
Top Bottom