Bug #72381 MySQL ODBC 5.2 ANSI Driver - ODBC Return on 31 characters of field name
Submitted: 18 Apr 2014 15:08 Modified: 18 Apr 2014 23:39
Reporter: John Skolits Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.2 OS:Windows (Win 7)
Assigned to: CPU Architecture:Any

[18 Apr 2014 15:08] John Skolits
Description:
In VBA-MSAccess - When creating a TableDef object and retrieving the field names, long field names are truncated to 31 characters.

Tried to add option 35 but still did not fix issue.

How to repeat:
Create a Schema 'Test_DB'
Create a table called "TableTest"
Create a field (column) called [TestFieldNameOfGreaterThan31Characters] 

Code:
Dim wkspMySQL As dao.Workspace
Dim dbMySQL As dao.Database
Dim strConnectString as string

'Add your own username and password
strConnectString ="ODBC;DRIVER=MySQL ODBC 5.2 ANSI Driver;SERVER=localhost;UID=[Username];PWD=[Password];DATABASE=Test_DB;PORT=3306;DFLT_BIGINT_BIND_STR=1; NO_PROMPT=1"

Set wkspMySQL  = CreateWorkspace("", "admin", "", dbUseJet)
Set dbMySQL = wkspMySQL.OpenDatabase("", True, True, strConnectString)

Dim tblDef As dao.TableDef
Dim fld As dao.Field
Set tblDef = dabsMySQL_CONNECTION_DB.TableDefs("TableTest")

For Each fld In tblDef.Fields
     Debug.print fld.name 'This will return "TestFieldNameOfGreaterThan31Cha"
next fld

Suggested fix:
Obvious answer is shorter field (column) names. I modified my code to handle that situation. But obviously, it should be fixed for future versions.
[18 Apr 2014 23:32] MySQL Verification Team
field name truncated

Attachment: field_name_odbc.png (image/png, text), 123.95 KiB.

[18 Apr 2014 23:39] MySQL Verification Team
Thank you for the bug report. See attached debug picture.