Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ODBC connection

    Hello,

    I am having a problem with ODBC connection. I am using code:

    odbc query "MS Access Database", dialog(complete)
    odbc load, table("`var`i''")
    export delimited using "`fvar`i''", replace

    My purpose is to tell the ODBC connection where to get the database file programatically, and export the missing files.

    But current code uses the dialog approach, which assumes there is a user to manually select the database.

    My question is: Is there a way to connect to ODBC and telling where to get the database file without requiring an user to do it manually?

    Thanks,
    Jessica

  • #2
    Add the name and location of your database file to your first line. Use semicolon delimiters and identify the database file name and location with DBQ.

    So, change
    Code:
    odbc query "MS Access Database"
    to
    Code:
    odbc query "MS Access Database;DBQ=F:\MyAccessDatabaseFile.accdb;"
    substituting the directory and name of your database file. Be sure to include both semicolons (before and after).

    Comment


    • #3
      Thank you Joseph!

      Comment

      Working...
      X