Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSN Less Connection Code Works in Access 2003 but Not 2010

Status
Not open for further replies.

nobull613

Technical User
Jun 6, 2003
76
US
I have used the following code referenced in the following link and it works fine in Access 2003:


When I attempt to use it in Access 2010 it kicks a Run-time error '3151'. The specific line that highlights when choosing to debug is CurrentDb.TableDefs.Append td

It doesn't seem to be a references issue as the keywords come up when typing in the code.

The 2003 and 2010 version are both pointing to the same MSSQL 2008 server/database with the same authentication method being used (Trusted Connection).

Again 2003 works but 2010 will not. Any direction for investigation would be greatly appreciated.

Thanks
 
I'd use this:
Dim db As DAO.Database
Set db = CurrentDb

and then replace all CurrentDb. with db.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PH, I tried that and it still yielded the same result (the Call-Failed error). Thanks for the advise though.
 
Correction to my initial post, I actually have Access 2007, not 2010. Thanks again for any help that can be provided.
 
Resolved, I put the code into a new 2007 database and it created the connections. I was able to import the other objects and it still worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top