When I've had this problem occasionally, I've found my best bet was to write
a Public Sub in a module that cycles through all tabledefs, checks their
Connect strings, replaces any previous DSN with the new one (or else just
sets the Connect string from scratch) and then terminates. Then
Compact/Repair. I can't give any logical reason why this should work, but it
has done for me in the past. A few other suggestions too:
a) Are you using ADODB recordsets? If so (though it sounds obvious) make
sure that wherever you specified the connection string for the ADODB
connection that they use, you've updated that to the new server
b) Are you using DAO recordsets? Make sure that
CurrentProject.ActiveConnection (might be CurrentDB. - can't remember) has
the up-to-date connection string.
c) As b) if you're using ADODB but opening your recordsets using the
d) Have you tried the /decompile switch (undocumented)? If you've got
hard-coded connection strings, this may be worth a try. Sometimes, for
reasons best known to itself, Access doesn't correctly work out which code
has already been compiled, and which has not. In any case, VBA code in
Access can be in any one of 11 states of compilation! So loading your DB
with Start-> Run-> "c:\your_msoffice_path_here\msaccess.exe" /decompile
"c:\path_to_your_db\mydb.mdb" (quotes as I've put them there) and then go to
the VBA Editor and do Debug-> Compile, that might fix it.
Hope that helps - let me know if it does.
From: Eric Lommatsch [mailto:EricL@stripped]
Sent: 21 April 2006 23:13
Subject: Access Error when linking/exporting Data through MySQL ODBC
I have been fighting this issue for the better part of a day. If someone can
suggest a way to figure this out I would appreciate the help.
At a client site they have begun the process migrating to a new Domain
server. At this site Microsoft access is used as a front end to MySQL. Today
I was trying to make sure that the linked tables in the access Database are
properly connected to the correct MySQL server, which is installed on the
I have updated the ODBC connection that I am using to link to this database
so that it points the the new server and all of my other applications that
use the ODBC connection appear to work correctly. But, when I open up the
access database it is still linked to the database on the old server. My
first thought was to simply delete the links to the Old server and replace
them with links to the new server. When I do this Access comes up with an
error message saying that an error has occurred and asking me if I want to
This appears to be happening on any computer that is located in this office.
I tried creating a new Access Database and same error is still occurring.
I have tried creating a brand new MySQL Database with only one dummy table
it and connecting to it from access and the results are no different.
I exported Data from the MySQL database and transferred it to our office and
in our office I am having no problem in linking to MySQL from Access.
I have even been able to write a small Access VBA Module that tested
connecting to the MySQL Database through the DSN and this worked.
Is this a case where because the Migration has not yet been completed Access
is confused on how to link to the ODBC DSN? Or is there something else that
have not yet thought of that I need to do to get this to work?
The client site has version 4.0.13 of MySQL Installed with MySQL ODBC
connector version 3.51.06 and Access 2002. Up until the migration process
started this seemed to work.
Eric H. Lommatsch
2087 South Grant Street
Denver, CO 80210