0

Access 365/Windows 10

I’m getting the “Could not find installable ISAM” error which I believe means I’ve a problem with my connection string below.

I did a right click, export on a single Access table to the MySQL backend so that I could link it and verify the driver, server, port, database, etc. of that connection against the connection string in the function below. It all looks good. Can you see what I've done wrong?

I have 128 tables to migrate to MySQL and am looking for a efficient, repeatable process; I had high hopes for this code...

'''

Public Function fncExportTables() As Boolean

  'Declare Variables...
    Dim strCnn As String
    Dim rs As Recordset
    Dim db As Database
    Dim strTp As String
    Dim strOriginal As String

  'The Connection String required to connect to MySQL. 
'I THINK THIS IS THE PROBLEM
   strCnn = "DRIVER={MySQL ODBC 8.0 Driver};" & _
                "SERVER=myServer;" & _
                "PORT=24299;" & _
                "DATABASE=myDb;" & _
                "USER=myUserName;" & _
                "PASSWORD=myPassword;" & _
                "OPTION=3;"
                                 
    strTp = "ODBC Database"

  'Trap any Errors...
  On Error GoTo Error_fncExportTables
 
  'Open a recordset from the table the conatains
  'all the table names we want to Link from the
  'MySQL Database.
  Set db = CurrentDb
  Set rs = db.OpenRecordset("qselMgr", dbOpenSnapshot)
  With rs
      'Fill the Recordset...
      .MoveLast
      .MoveFirst
      'Enumerate through the Records...
      Do Until rs.EOF
        'Place the Table Name into the str string variable.
        ' FieldName (below) would be the Field name in your Access
        ' Table which holds the name of the MySQL Tables to Link.
        strOriginal = !strOriginalName
        'Make sure we are not dealing will an empty string..
        If Len(strOriginal) > 0 Then
            'Link the MySQL Table to this Database. 
'ERROR TRIGGERS ON THE LINE BELOW
            DoCmd.TransferDatabase acExport, strTp, strCnn, _
                  acTable, strOriginal, strOriginal
        End If
        'move to the next record...
        .MoveNext
      Loop
  End With
  'We're done...
 
Exit_fncExportTables:
  'Clear Variables and close the db connection.
  Set rs = Nothing
  If Not db Is Nothing Then db.Close
  Set db = Nothing
  Exit Function
 
Error_fncExportTables:
  'If there was an error then display the Error Msg.
  MsgBox "Export Table Error:" & vbCr & vbCr & _
          Err.Number & "  -  " & Err.Description, _
          vbExclamation, "Export Table Error"
  Err.Clear
  Resume Exit_fncExportTables
End Function

'''

  • I see you are using port 24299 for MySQL. Are you sure this is correct? The default port for MySQL is 3306, unless you changed it deliberately. If you can connect to MySQL using another client, you can query `SELECT @@port;` to check the current value it is configured to use for that option. – Bill Karwin Apr 26 '22 at 03:11
  • Yes 24299 is correct. I am able to export a table by right click | export and then link back so I can see the connection string on that table to compare to the code above. The driver, server, port, database, etc all correct. I figured it was a syntax issue in the connection string. – SQL newbie Apr 26 '22 at 13:47
  • I wasn't able to resolve the DSN less connection string error. Continued to get the "Could not find installable ISAM" regardless of variations I tried with the connection string. I switched my export approach to using the saved DSN file and discovered that this worked as long as I removed the password in the ODBC window and reentered my password for each table exported. To clarify, the password in the code and the password I am reentering in the ODBC window is the same. I'm guessing the password issue explains the failure in the DSN less connection? – SQL newbie Apr 26 '22 at 15:58
  • I have no idea, I don't use Access or Windows. – Bill Karwin Apr 26 '22 at 16:06

0 Answers0