引用"ODBC Driver & Data Source Name Functions"及“Registry Access Functions”
Sub SetODBC()
On Error GoTo EE
Dim str As String
If CreateDSN("odbc_publish_chw", "MicroSoft Visual FoxPro Driver", "", "", "", "", "", True, "") = False Then
    MsgBox "ERRROR1`"
End If
If GetKeyValue(HKEY_CURRENT_USER, "SoftWare\ODBC\ODBC.INI\odbc_publish_chw", "sourcedb", str) = True Then
    If Trim(str) = "" Or bIsSelect = True Then
        Form2.Show 1
'        CommonDialog1.Filter = "Foxpro Files(*.dbc)|*.dbc"
        If bcancel = True Then
            Exit Sub
        End If
        If UpdateKey(HKEY_CURRENT_USER, "SoftWare\ODBC\ODBC.INI\odbc_publish_chw", "SourceDB", pathname) = False Then
            MsgBox "ERROR"
        End If
    End If
    bIsSelect = False
End If
Exit Sub
EE:
    MsgBox Err.Description
End Sub