Hello everyone,

I'm trying to connect to a access 2007 database with VB 9 and am having some problems.

I went to Data and then selected add new datasource.

Then I clicked on database and selected Next.

I click on new connection, change the datasource to access database file and then click ok.

Now I'm stuck. It doesn't give me a browser box so I can choose where my access database file is. All it shows me is a connection string label and a text box to the right of it. I tried entering the full path to my accdb file in that connection string box and also just the name of the file itself since it's in the same directory but get the error message "format of the initialization string does not conform to specification starting at index 0."

Also, when I click on test connection, it always says succeeded even though no database has been selected.

Any idea's?

thx

Recommended Answers

All 4 Replies

I found this connection string format to use to connect:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Shawn Minisall\Desktop\Homework 6\SongNames.accdb;

but I get the format initialization string error message.

I found this connection string format to use to connect:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Shawn Minisall\Desktop\Homework 6\SongNames.accdb;

but I get the format initialization string error message.

The string connection above is not applicable for MS Access 2007 DB.

You can use this one:

"Provider ="Microsoft.Ace.OLEDB.12.0;Data Source=c:\database\mydatabase.accdb;Persist Security Info=False"

Thanks but that didn't work either, I still got the same error as before.

I installed VB 9 on my laptop and found that it gives me the browse box to choose the access 2007 database file that I needed.

Very strange...I uninstalled and reinstalled VB 9 on my desktop and it still just gives me the connection string without that browse box to find the database file.

I guess whenever I need to add databases from now on, I'll be doing it from my laptop.

:)

I also use that string in my project But it's give error.
My string is that string str="Provider=Microsoft.Ace.OLEDB.12.0;Data Source=\Cyber-Cafe.accdb;Persist Security Info=False";
And Also use That String : String str="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\Cyber-Cafe.accdb";
Both are Not Working.
Then What Can i do. please help me..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.