Results 1 to 3 of 3
  1. #1
    ellenr is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Apr 2011
    Posts
    2

    ODBC connection string can't connect- Thank for any help error 3151


    Windows 7, msaccess 2010 32bit. My db has been running several years and connecting to BE mysql with a mysql connector dsn. Now I need to deploy it to more users in distant locations, so I am trying to connect using vba connection string for a dsn-less connection. I cannot get it to connect and it is throwing a 3151 error. The techs at this particular host assure me they can see nothing wrong from the server end. I have another db that is able to connect dsn-lessly to a different mysql db on the same server, so I don't think it is a firewall problem. I don't even know where to start solving this--also my research hasn't enlightened me as to the 3151 error. Thanks for any help!

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Try reading through this link. Apparently ODBC connection errors can throw, essentially, multiple errors with the first one being just a generic "ODBC call failed". The link shows how you can work through the list of errors and get more specific information on your problem. It's written for Access 2000, but hopefully it'll work in 2010 too.

    http://support2.microsoft.com/defaul...b;EN-US;209855

  3. #3
    ellenr is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Apr 2011
    Posts
    2
    I have finally solved my problem. I had to delete all odbc-linked tables from the db. Then, I had to place the following code in the opening vba following the code setting up the connection string and the line: "Set MyODBCdb = DBEngine(0).OpenDatabase("DBname", dbDriverNoPrompt, True, MyConnectionString)"

    Code:
    Dim tdfCurrent As Variant 'do the following for any new table

    Set tdfCurrent = CurrentDb.CreateTableDef("Docs")
    tdfCurrent.Connect = MyConnectionString
    tdfCurrent.SourceTableName = "Docs"
    CurrentDb.TableDefs.Append tdfCurrent
    The last four lines had to be completed for each one of the tables to be linked. After the code runs once and the table links appear in the table list, this code must be removed.

    I hope this helps someone else struggling with the same problem.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-02-2015, 09:44 AM
  2. Replies: 2
    Last Post: 01-21-2014, 11:23 AM
  3. Connect System DSN using connection string
    By jbailey4545 in forum Access
    Replies: 0
    Last Post: 11-08-2013, 01:29 PM
  4. Replies: 0
    Last Post: 04-25-2012, 07:59 AM
  5. Replies: 2
    Last Post: 11-10-2009, 02:49 PM

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