473,396 Members | 1,840 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.

ODBC Connect issue

4
Hi guys

Following on from an issue a couple of years back, now archived:

http://www.thescripts.com/forum/thre...f.connect.html

I'm having the same problems.

I can update the Querydef.connect property programmatically without any problems, however if I try to update the Tabledef.connect property it won't do it, even though it runs through the code successfully.

When I try to manually update the connect column in MsysObjects it won't let me do it, gives a "Control Can't be Edited; It's Bound to Replication System Column Connect" message in the control bar, so I'm guessing this is related...

Any help on this would be appreciated.

FYI the code is below, and we do not use in-built Access database security on our Access dbs (could this be why it won't let me edit it through code?)
Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Set db = CurrentDb
  3.  
  4. 'Reset the connection property for all pass through queries for DB1 database only
  5.  
  6. For Each QueryDef In db.QueryDefs
  7.   If QueryDef.Connect Like "*DATABASE=DB1*" Then
  8.     QueryDef.Properties("Connect") = gblConnectionString
  9.     QueryDef.Properties.Refresh
  10.   End If
  11. Next
May 9 '07 #1
2 5306
daft
4
OK I think I might be on to something here

"For Database objects, new Connection objects, linked tables, and TableDef objects not yet appended to a collection, this property setting is read/write. For QueryDef objects and base tables, this property is read-only."

This seems to suggest that because a querydef is opened then closed I can edit the connection, but because a connection is open to an ODBC linked table it is seen as a base table and therefore read-only... so maybe I need to close the connection before updating? Hmmm.

Also I missed a section of the code snippet... trying this one...
Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Set db = CurrentDb
  3.  
  4. Dim strTableName, strSourceTableName As String
  5. Dim objTableDef As TableDef
  6.  
  7. 'Reset the connection property for all pass through queries for DB1 database only
  8.  
  9. For Each QueryDef In db.QueryDefs
  10.  
  11.  If QueryDef.Properties("Connect") Like "*DATABASE=DB1*" Then
  12.   QueryDef.Properties("Connect") = gblConnectionString
  13.   QueryDef.Properties.Refresh
  14.  End If
  15.  
  16. Next
  17.  
  18. 'Reset connections for linked tables for DB1 database only
  19. For Each TableDef In db.TableDefs
  20.  If TableDef.Connect Like "*DATABASE=DB1*" Then
  21.   TableDef.Properties("Connect") = gblConnectionString
  22.   TableDef.Properties.Refresh
  23.  End If
  24. Next
  25.  
  26. End Function
May 10 '07 #2
nico5038
3,080 Expert 2GB
Hmm, not sure or the LIKE will work as expected, why not try for your tables:
Expand|Select|Wrap|Line Numbers
  1. For Each TableDef In db.TableDefs
  2.   If TableDef.Connect <> "" Then
  3.     TableDef.Properties("Connect") = gblConnectionString
  4.     TableDef.Properties.Refresh
  5.   End If
  6. Next
  7.  
Thus all tables with a connection will be reconnected and the Msys (read-only) tables skipped.

Nic;o)
May 13 '07 #3

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

Similar topics

0
by: Chetan | last post by:
I have setup an ODBC driver for my MySQL database and use a 3rd party program to connect to it. Everytime the software connects, the ODBC driver setup screen pops up. I have to click OK on it to...
8
by: Philip Wright | last post by:
I am trying to connect to a DB2 v7.2 database from Lotus 123 v9.8 on a Windows XP Pro machine. I have the Software Development Client installed on the XP machine and have run the Client...
1
by: Pradeep | last post by:
DB2ers, Our Windows application connects to any DB2 server using the ODBC driver. It seems there are two ODBC drivers that IBM provides - DB Connect and DB2 Runtime Client. We have tested our...
9
by: mcbill20 | last post by:
Hello all. I just installed Oracle 10g developer tools on a machine running XP Pro and Office XP. Before this I had just the Oracle 9 client installed. I the previous configuration, I was able to...
1
by: paul_tomlin | last post by:
We connect via terminal services to an excel spreadsheet that has an ODBC link to an access database using a pivot table, when we try to refresh the data within the excel spreadsheet we receive the...
4
by: Jean | last post by:
Hi everyone, I was hoping somebody could assist me in this issue. I am quite a newbie to ODBC connections and was struggling to search for related topics. Here is my situation: I have a...
4
by: Bob Sanderson | last post by:
I am trying to set up an ODBC DSN to our company MySQL database so that I can use a MS Access front end. I am using the MySQL ODBC 3.51 driver. The database is running off of Apache on our Windows...
8
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
1
by: powerfulhosting | last post by:
I'm trying to allow someone from a specific IP to connect to a mySQL db w/OBDC. I've run several GRANT queries on the mysql db i.e. GRANT select,update,insert,delete,create,drop,alter,index on...
2
by: Dale Sampson | last post by:
My app uses an ODBC connection for a .mdb file. I want the app to create the source if it does not already exist (I copy a blank .mdb file to the users data store if it doesn't exist). I see how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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,...

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.