Skip to content

Instantly share code, notes, and snippets.

@felixlindemann
Created August 26, 2013 12:34
Show Gist options
  • Save felixlindemann/6340977 to your computer and use it in GitHub Desktop.
Save felixlindemann/6340977 to your computer and use it in GitHub Desktop.
Translate Access FieldTypes to MYSQL --> Rough Way here - Can be improved!
' translate access dbtypes to mysql types --> Rough way here.
Private Function getFieldType(value As Integer, Optional isPK As Boolean = False) As String
' compare to http://allenbrowne.com/ser-49.html
Dim str As String
str = ""
Select Case value
Case 1
str = "Boolean"
Case 3, 4
str = "int(11)" & IIf(isPK, " AUTO_INCREMENT ", "")
Case 6, 7
str = "double"
Case 8
str = "datetime"
Case 10, 12, 109
str = "longtext"
Case Else
str = "not supported"
End Select
getFieldType = str & IIf(isPK, " PRIMARY KEY ", "")
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment