473,466 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Refreshing a Linked ODBC Table

1 New Member
Hello Everyone,

Looking for some guidance on an issue I'm having in regards to a Linked ODBC table. I have linked the ODBC table and am looking to refresh the connection upon open of the database. I'm hoping to have this pop up as soon as it opens so the user will not have to log in at a later point in time in the process. The code works to a certain extent. It will refresh the linked table but than when I try to access the link table it asks for user password 3 additional times. Any thoughts? This is based on an AutoExec macro to run the code upon open.

Expand|Select|Wrap|Line Numbers
  1. Public Function RefreshTable()
  2.  
  3. Dim strLocalTableName As String
  4. Dim strConnection As String
  5. Dim daoTableDef As DAO.TableDef
  6. Dim dbs As Variant
  7.  
  8. strLocalTable = "EDW_PROD_MTH_CUSTOMER"
  9. strConnection = _
  10. "ODBC;DSN=EDWPRO;APP=Microsoft Office Access 2010;DATABASE=EDWPRO;TABLE=EDW_PROD.MTH_CUSTOMER"
  11.  
  12. Set dbs = CurrentDb()
  13.  
  14. Set daoTableDef = dbs.TableDefs(strLocalTable)
  15. daoTableDef.Connect = strConnection
  16. daoTableDef.RefreshLink
  17.  
  18. Set daoTableDef = Nothing
  19.  
  20. End Function
Aug 2 '12 #1
2 6545
zmbd
5,501 Recognized Expert Moderator Expert
Please use the "[code]...[/code]" tags around your code.

See if the following will help:
Expand|Select|Wrap|Line Numbers
  1. sConnect = "MS Access;PWD=" & sPassword & ";" & "DATABASE=" & sPath & sDatabaseName
for more detail... click on the ".connect" protion of your code in the VBA editor and [f1] for context help.

-z
Aug 12 '12 #2
NeoPa
32,556 Recognized Expert Moderator MVP
Check out Relinking ODBC Tables using VBA.

If it's an Access table, why are you using ODBC anyway?
Aug 12 '12 #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...
3
by: Kyle Arrington | last post by:
I have a network server with MySQL on it and I am trying to make access update the information it has in its linked table on startup or command. I know nearly nothing about macros or modules. I...
0
by: LesM | last post by:
This is a change of behaviour between Access 2000 SP3 and Access 2002 SP3. I have Progress table that is linked via ODBC into Access using OpenLink Lite for Progress 9.0b. For over a year, using...
4
by: Rich | last post by:
I have a access form that is connected to linked sql table via odbc. I have some fields that I dont want to allow nulls when data is entered via the form. I can set the null checking on the SQL...
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...
3
by: colin.anderson | last post by:
Hi I am trying to refresh table links at startup in an Access 2002 application. The following code is based on a number of articles posted in this group but this does not seem to work: ...
1
by: JM | last post by:
Hello, A very simple select query (no joins) to a linked ODBC SQL Server 2000 table produces incorrect results. The right number of rows seem to be returned, but some of the columns have...
0
by: JM | last post by:
After I converted the back-end of an Access database to a linked ODBC SQL Server DB, programmatic filtering on a subform bound to a query no longer works. Is this common, and is there a decent...
2
by: mvl_groups_user | last post by:
I am trying to look up data on about 1000 records from a 6 million record view on a DB2 database using msaccess. The 6 million record DB2 view is connected through a linked ODBC table (table A),...
1
by: Scott | last post by:
Is it possible to edit/input a ODBC table in MS Access?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.