VB 导出对 Mysql 的货币格式访问失败

VB Export Access to Mysql fails on currencies format

Access 2003 上的以下 VBA 脚本将所有表和数据导出到 MySQL。 除货币数据外,一切正常,它们被转换为整数而不是浮点数。浮点数已正确导出。

在 Access 2003 中

price : 1,22 € (currency format)
VAT : 1,115 (float)

成为 mysql:

price : 1
VAT : 1.115

这是脚本:

Option Compare Database

Private Sub Détail_Click()

End Sub

Private Sub export_mysql_Click()
    On Error GoTo Err_export_mysql_Click

        Dim sTblNm As String
        Dim sTypExprt As String
        Dim sCnxnStr As String, vStTime As Variant
        Dim db As Database, tbldef As DAO.TableDef

        On Error GoTo ExportTbls_Error

        sTypExprt = "ODBC"
        'sCnxnStr = "ODBC;DSN=DSNname;UID=userOnServer;PWD=pwdOnServer"
        sCnxnStr = "ODBC;DSN=exporteau;UID=exporteau;PWD=xxxxxxxxxxx" 'Create the connection string
        vStTime = Timer
        Application.Echo False, "Visual Basic code is executing."

        Set db = CurrentDb()

        For Each tbldef In db.TableDefs
        Debug.Print tbldef.Name
        sTblNm = tbldef.Name
        DoCmd.TransferDatabase acExport, sTypExprt, sCnxnStr, acTable, sTblNm, sTblNm
        Next tbldef

        MsgBox "Exportation terminée"
        On Error GoTo 0
SmoothExit_ExportTbls:
        Set db = Nothing
        Application.Echo True
        Exit Sub

ExportTbls_Error:
        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ExportTblsODST"
        Resume SmoothExit_ExportTbls

Exit_export_mysql_Click:
            Exit Sub

Err_export_mysql_Click:
            MsgBox Err.Description
            Resume Exit_export_mysql_Click

End Sub

Private Sub export_mysql_DblClick(Cancel As Integer)

End Sub

MS Access 2002 使用货币的系统区域设置。

一旦设置为用 . 代替 , 分隔小数点,我就得到了我的数字。