通过 Docmd TransferDatabase 将表从 MS Access 导出到 Snowflake

Exporting tables from MS Access to Snowflake via Docmd TransferDatabase

DoCmdTransfer 数据库失败并出现 运行-时间错误 3146 ODBC 调用失败。 无法执行 CREATE TABLE。此会话没有当前架构。调用 'USE SCHEMA',或使用限定名称。

DoCmd.TransferDatabase acExport, "ODBC Database", "ODBC;DSN=ODBC32- 
AccessToSWF;UID=yyyy;PWD=xxxx;LANGUAGE=us_english;" & "DATABASE=test", 
acTable, "WB_EXP_OUT", "WB_EXP_OUT"

我希望在测试数据库的默认架构中将 table "WB_EXP_OUT" 导出到 Snowflake。 我没想到会被请求架构,我不知道在代码中的什么地方输入它。

看起来您使用的工具使用的是 ODBC driver。 根据您的问题标题,您似乎在使用 https://docs.microsoft.com/en-us/office/vba/api/access.docmd.transferdatabase 和 Visual Basic,您使用的是 DSN 工具吗?

如果是这样,我确实找到了另一个有这个错误的用户,并在 Suzy 的评论中修复了它。 https://community.snowflake.com/s/question/0D50Z00009LIzbGSAT/export-from-ms-access-to-snowflake-missing-pwd-error

FrankBullit 3 months ago @suzy... I have an update on the docmd method: I think I have established the connection but it fails with Run-time error '3146' ODBC call failed.

Cannot perform CREATE TABLE. This session does not have a current schema.

Call 'USE SCHEMA' or use a qualified name.

Here is the code, but I was unable to find a fix that works

DoCmd.TransferDatabase acExport, "ODBC Database", "ODBC;DSN=ODBC32-AccessToSWF;UID=edifolco;PWD=xxxx;LANGUAGE=us_english;" & "DATABASE=test", acTable, "WB_EXP_OUT", "WB_EXP_OUT"

Not sure you can really specify a Schema.

suzy.lockwood 3 months ago

Hi ... These are some very curious errors. Are you using either a system or user DSN via the Data Source Administration tool? The DSN needs to be configured and then it should have an associated entry in the registry where you can edit the additional parameters. The DSN can also have the schema or database parameters, or you can include in the registry entry as well.

有帮助吗?