Results 1 to 4 of 4
  1. #1
    torunsu is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2011
    Posts
    9

    How to configure odbc-connection from vba-code

    Hi!



    I have discovered a seriously annoying problem with Access 2003. I have linked some tables from SQL Server 2005, and if I change a table or if I set the linked tables to go to an odbc connection with another name, I need to link all the tables again. ALL of them, manually. Refresh does not help.

    So - my question is:

    How do I (if I can) change the odbc connection to go to another database (without changing the name of the connection) from vba code?

    Hope you understand.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If I'm understanding your problem correctly, the easiest solution is set up the ODBC connection to your database the SAME on every computer. You're not doing that, there's a difference in spelling or something that is making your database not recognize the connection from computer to computer. Is there a reason basically the same connection is named differently on different computers?

    You can refresh links with VBA (to accomodate the new fields etc) but you should really make a 'global' name for the ODBC connection.

    See this thread for an example of refreshing links:

    https://www.accessforums.net/import-...les-16473.html

  3. #3
    torunsu is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2011
    Posts
    9
    The reason I need to know this, is that I need to make a button that switches to another database. I want to switch between the test and the production database. But if I make it switch to another odbc connection, the application crash. Therefore, I need to change the connection itself. Kind of...

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442

Please reply to this thread with any new information or opinions.

Similar Threads

  1. ODBC connection and splitting the DB
    By crowegreg in forum Access
    Replies: 3
    Last Post: 08-30-2011, 11:02 AM
  2. ODBC 32 to 64 Bit connection error
    By mgmtexecit in forum Reports
    Replies: 0
    Last Post: 03-30-2011, 10:06 AM
  3. ODBC 32 to 64 Bit connection error
    By mgmtexecit in forum Access
    Replies: 1
    Last Post: 03-30-2011, 10:05 AM
  4. Odbc connection to 'datasourcename' failed
    By nmcentire in forum Import/Export Data
    Replies: 1
    Last Post: 11-24-2010, 07:28 PM
  5. ODBC connection
    By avicenna in forum Import/Export Data
    Replies: 2
    Last Post: 08-02-2010, 02:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums