Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting data form access database running excel macro

Status
Not open for further replies.

edita

Programmer
Mar 26, 2003
14
PL
Hi
I'm writing macro in Excel and I need to get data from database which is in Access.
As I know I need to add some libraries in Tool/References and I added:
Microsoft Access 10.0 Object Library
Microsoft DAO 3.6 Object Library
Microsoft ADO ...

How can I declare variable as ADODB.Connection, for example?
Have you got any examples of procedures that could help me?

Thanks in advance,
bye
 
DAO and ADO are "competing" database technologies. There is no point attempting to use both. I would suggest using ADO over DAO as it is a newer and faster technology.

Also this is a Visual Basic forum not a Visual Basic for Applications forum (which is the language you are using when coding in Excel). They are not the same.

To declare a object variable as ADODB.Connection:

Dim conX As ADODB.Connection

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"Why does my program keep showing error messages every time something goes wrong?"
 
I tried

Dim conX As ADODB.Connection

but it return error: User-defined type not defined.

By the way, do you know any Visual Basic for Application forum?

Thanks,
Bye
 
Okay, in Tools \ References put a check next to "Microsoft ActiveX Data Objects 2.x Library" (ADO has versions 2.0 through to 2.8) then try again.

forum707 is the VBA forum.

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"Why does my program keep showing error messages every time something goes wrong?"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top