Excel 2010 connect to Access 2010

escott

New Member
Joined
May 14, 2011
Messages
15
I want to execute SQL from excel to access. Run update, insert and select queries from excel to access. I have done this before with 2003, but with 2010 I think I am running into issues with connection strings lining up correctly with the reference library. Although I understand VBA pretty good, I don't know much about library and connection strings. I am not sure what reference library to select to go with my connection strings. I keep getting errors on connect like file not found or missing driver. Its like it cannot see the access database.

2010 is newer so there is less code on the web to copy. This is a very simple app. I am just missing something simple little to make it work and I don't know what it is. Please help.

I am hoping for a short simple piece of code from sub to exit sub and to know the references to go with it. I can make the code pretty late
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Could you post an example of the code you are having problems?

By the way I can't quite see how you can't find relevant code.

Perhaps you've narrowed your search to much by being too specific.

For example if you just search for 'connection strings' you'll get plenty of results.

To narrow that down you could just add Excel or Access, even ADO if that's what you are trying to use.

In fact if you are using ADO them including it in your search terms might be the best bet.
 
Upvote 0
I just nailed it


This made the difference. Not sure why but it worked.


Replaced string Provider=Microsoft.Jet.OLEDB.4.0;

with string Provider=Microsoft.ACE.OLEDB.12.0;
 
Upvote 0
Hy escott,

I'm using exactly this code and work very well. But when I use password it accuses "Invalid Password" despite the password is correct.

Myconn = Diretorio & "\RH_Access.accdb"
Set cnn = New ADODB.Connection
With cnn
.Provider = "Microsoft.ACE.OLEDB.12.0"
.Properties("data source") = Myconn
'.Properties("User ID") = "Admin"
.Properties("Jet OLEDB:Database Password") = "daniel"
.Open
End With
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,158
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top