473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Refreshing Linked Tables in VBA

Hello All,

Is there a way to refresh a linked table programatically through VBA (as part of an error handler). I have an Access database with several tables linked through ODBC. User forms are in a front end MDB file. Sometimes, I must make changes to the data model that don't necessarily affect the front end forms for most of my users. When this happens, I have to refresh the tables and send a new copy of the MDB file out to all my users - even if there is no new functionality in the forms. This is an obvious pain. People get confused about which version of the front end file to be using and results in a lot of unnecessary troubleshooting.

I was wondering if there was a way to maybe "version" the tables, look up in another table the most recent version number of each table, and refresh only those tables that do not have the most recent version number.

Is this possible? If so, can someone please point me in the right direction?

Thanks,
Josh
Aug 10 '07 #1
2 10933
Scott Price
1,384 Expert 1GB
Hi Josh,

Have a look at this post:

http://www.thescripts.com/forum/thread688654.html

You'll likely have to modify the code contained there, but it might be the nudge in the right direction you need...

Regards,
Scott
Aug 10 '07 #2
puppydogbuddy
1,923 Expert 1GB
Hello All,

Is there a way to refresh a linked table programatically through VBA (as part of an error handler). I have an Access database with several tables linked through ODBC. User forms are in a front end MDB file. Sometimes, I must make changes to the data model that don't necessarily affect the front end forms for most of my users. When this happens, I have to refresh the tables and send a new copy of the MDB file out to all my users - even if there is no new functionality in the forms. This is an obvious pain. People get confused about which version of the front end file to be using and results in a lot of unnecessary troubleshooting.

I was wondering if there was a way to maybe "version" the tables, look up in another table the most recent version number of each table, and refresh only those tables that do not have the most recent version number.

Is this possible? If so, can someone please point me in the right direction?

Thanks,
Josh
Josh,

This code from the tips page of www.aadconsulting.com seems to be what you are looking for. Hope it helps.
Expand|Select|Wrap|Line Numbers
  1. Public Function RefreshLinks(strFilename As String) As Boolean
  2. ' Refresh table links to a backend database - strFilename (full path)
  3. ' Returns True if successful. 
  4.  
  5. ___Dim dbs As Database
  6. ___Dim tdf As TableDef
  7.  
  8. ___' Loop through all tables in the database.
  9. ___Set dbs = CurrentDb
  10. ______For Each tdf In dbs.TableDefs
  11. _________' If the table has a connect string, it's a linked table.
  12. _________If Len(tdf.Connect) > 0 Then
  13. ____________tdf.Connect = ";DATABASE=" & strFilename
  14. ____________Err = 0
  15. ____________On Error Resume Next
  16. ____________tdf.RefreshLink ' Relink the table.
  17. _______________ If Err <> 0 Then
  18. __________________RefreshLinks = False
  19. __________________Exit Function
  20. _______________ End If
  21. _________End If
  22. ______Next tdf
  23.  
  24. ___RefreshLinks = True ' Relinking complete.
  25.  
  26. End Function
Aug 11 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
5
by: Scott Tilton | last post by:
I am having a terrible time getting this to work. I am hoping someone out there can help me with very specific code examples. I am trying to get the linked tables in my Access 97 database to be...
2
by: Robert McGregor | last post by:
Hi all, I've got a Front End / Back End database that was working just fine. One day i opened the FE to find that if I tried to open one of the linked tables from the database window, nothing...
4
by: Neil Ginsberg | last post by:
I have ODBC linked tables to a SQL 7 database in an A2K database. The linked tables do not have the password stored in them, so the first time the user accesses them, they need to enter the SQL...
7
by: Joe | last post by:
I am using Access 2003 and are linking to an Oracle 9i ODBC datasource (using Oracle ODBC drivers). After linking the tables in Access, I inspect the data contained in the linked tables. For...
6
by: Lewis Veale | last post by:
I have an Access 2000 front-end pointing at a SQL Server backend, with around 80 linked tables and views. I frequently need to point the front-end at different versions of the back-end, and achieve...
2
by: Jill Elaine | last post by:
I am building an Access 2002 frontend with linked tables to an encrypted Paradox 7 database. When I first create these linked tables, I'm asked for the password to the encrypted Paradox database,...
3
by: RobinAG | last post by:
Hello all, I have a front and back end to my database. The back end holds only tables, while the front end holds all forms, reports, queries and modules, with links to all the tables in the BE....
1
by: sweeneysmsm | last post by:
Working in Access 2003, Windows XP Pro - (client not faithful to updates:(. I have succeeded in splitting a database. (I am actually working on a "test run copy" to insure that I am safe. My...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.