We help IT Professionals succeed at work.

How to read data from a access database?

Medium Priority
530 Views
Last Modified: 2012-05-06
How can I work with an access database from Microsoft Excel's vba?

I've tried the following code, but I'm receiving Run-time error '3706' (on the third line)
(Microsoft Office 2007)

thanks for any kind of help.

Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    
    Set dbs = OpenDatabase("Y:\Receiption\Orders.accdb")
    Set rst = dbs.OpenRecordset("tblOrders")
 
    with rst
          .moveFirst
          ............
          'some code here
          ............
    end with

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2015
Commented:
Have a look over this...this would help you over your problem...
http://www.codebase.com/support/kb/?article=C01014
Saurabh...

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
thanks for your help.

I searched the whole C drive for c4dll.dll - c5oledb.dll - c5oleErrLkp.dll
nothing was found.

Any further help is much appreciated.
CERTIFIED EXPERT
Top Expert 2015
Commented:
That might be the problem..because if the dll which is c5oledb.dll and c5oleErrLkp.dll is missing then you need to either load them and register it..to make it work...

Author

Commented:
How can I load or register these dlls?

copying them from Office 2007's DVD? or any place to download them?


thanks
CERTIFIED EXPERT
Top Expert 2015
Commented:
I believe  go and copy it from office 2007 dvd as im unable to find it over the internet...just install the full version of acess and excel..and i think it would be moved over automatically...

Author

Commented:
I searched the DVD for the mentioned dlls, but nothing was found.
I uninstalled and reinstalled office, still the same problem .

I also searched for the same dlls in my PC at home that comes with
a pre-installed Office Enterprise 2007, but I failed to find the mentioned dlls.


any kind of further advice is much appreciated.

CERTIFIED EXPERT
Top Expert 2015
Commented:
Thats weird...im not sure about any other reasons because of which this is happening...

Author

Commented:
where these dlls are supposed to be located at?
CERTIFIED EXPERT
Top Expert 2015
Commented:
These dlls suppose to come with full installation..did you re-install access as well..??

Author

Commented:
yes. I did. I'm trying it once more just now.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.