5

I have a few data sources in access that I need to connect to programatically to do things with behind the scenes and keep visibility away from users.

Said datasource has a password 'pass' as I'm going to call it here. Using this connection method I get an error attempting to use the open method

Dim conn as ADODB.Connection
Set ROBBERS.conn = New ADODB.Connection
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;" _
        & "Data Source=\\pep-home\projects\billing\autobilling\DPBilling2.mdb;" _
    & "Jet OLEDB:Database Password=pass;", "admin", "pass"

"Cannot start your application. The workgroup information file is missing or opened exclusively by another user."

Due to planning to move into 2007, we are not using nor have ever used a workgroup identification file through access. The database password on the data source was set through the Set Databa Password which had to be done on an exclusive open.

Ive spent a good while changing around my connection options, where to put the passwords etc and either cannot find the right format, or (why I'm asking here) I think there may be some other unknown that I must setup to do this. Anyone out there got some useful information?

Mohgeroth
  • 1,617
  • 4
  • 32
  • 47
  • The problem is more complex than this. The problem was because I was holding connections through a class, I had a few mistakes I figured out such as returning a ADODB connection without a SET command before it, attempting to open the connection within the class and within the module (where it was already open, hence the error that its already open). There was a mistake in the connection string however, hence the accepted answer :) – Mohgeroth Mar 18 '10 at 17:50
  • Could you please explain how you solved this problem or give a reference to the information that helped you? That way there is a solution available to anyone else having this error message, like myself ~~ – JPK Mar 11 '14 at 11:34
  • As shown in the answer below it was a simple mistake in my connection string. Unfortunately like many error messages presented in most any language (VBA is no exception), the one mentioned was a red herring; not related to what the actual issue was. – Mohgeroth Mar 13 '14 at 20:29

1 Answers1

16

Your connection string seems to be incorrect. Try:

conn.open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=\\pep-home\projects\billing\autobilling\DPBilling2.mdb;" _
& "Jet OLEDB:Database Password=MyDbPassword;"

-- http://www.connectionstrings.com/access

Fionnuala
  • 90,370
  • 7
  • 114
  • 152
  • I had this error while accessing from C# to MDB file, and in my case I had to add the MDW to the connection string. see example [here](http://stackoverflow.com/a/18307822/426315) – itsho Jan 02 '14 at 13:15
  • +1: I had the same error accessing a .accdb file with C# .NET, and changing the connection string like in the example did not help. However, after changing my Access client to "Use legacy encryption" (good for reverse compatibility and multi-user databases) after reading the note on that page (Note! Reports say that a database encrypted using Access 2010 - 2013 default encryption scheme does not work with this connection string. In Access; try options and choose 2007 encryption method instead.), it worked! I did not try to specify the local .mdw file explicitly as you did though, @itsho. – Skovly Apr 16 '16 at 14:37
  • 1
    In my case I was importing data from Access via SQL Server Management Studio, and it had set the "password" property rather than "Jet OLEDB:Database Password" which I could set via the advanced settings. – Bridge Feb 15 '17 at 11:43