Search code examples
vbaodbcmyob

Database keyword missing error for MYOB ODBC in VBA


I'm a newbie VBA developer for my company and I'm trying to set up a DSN-less connection string to our MYOB files via the MYOB ODBC.
I have followed the MYOB ODBC documentation in regards to the connection string and it currently looks like this:

ConnDetails.Open "Driver={MYOAU1001}; TYPE=MYOB; UID=TestUser; PWD; 
    DATABASE=C:\Reference\Test.MYO; HOST_EXE_PATH=C:\Premier19\Myobp.exe; 
    NETWORK_PROTOCOL=NONET; DRIVER_COMPLETION=DRIVER_NOPROMPT"

I am getting the error:
[MYOB ODBC]General error - Database keyword not present in the connect string

I have searched online and haven't found anything that clarifies how to avoid this error or what it actually means, given that I have specified the database keyword within the string.

Any help on this matter is welcome.


Solution

  • The error in my case was a result of using PWD; instead of PASSWORD=;.
    The username I use has no associated password to access the MYOB file and the documentation advises that you can use PWD.
    It would seem this advice is incorrect for some reason.