QA.TechInterviews.com - your tech questions answered
Visual Basics For Application Programming Question?
I run a program and get a complier error following statement.

Dim c As ADODB.Connection

It notices that ADODB have not been defined. How can i fix it?

Thanks!!!
in VBA editor go to tools then look for References then check MS ADO 2.5 library or whatever ado version library you want to use. good luck!
Well there are two causes for this problem.

1. The variable "c" which in your case is of the Connection datatype might not have been defined. This can be overcome by the following code:

Dim c as new ADODB.Connection
or

Dim c as ADODB.Connection
Set c = new ADODB.Connection

2. If you had already defined the variable correctly but still get the "Object not defined" error, then this might be because the ADODB Object Library might not have been included in the references.
To overcome this, do the following:

a. Goto "Tools" Tab in VBA Editor
b. Click on References
c. Make sure that the " Microsoft ActiveX Data Object 2.1 Library" checkbox is checked. >>> This includes the objects and methods for the ADODB Connection

I guess this should resolve your problem. Enjoy
not to sound like a prick but it seems as if you have to define ADODB, I would really need to see a tidbit of source code but maybe you're not linking to it how many header files have you made etc. its either not defined or you're not linking to it

w/o any source code for me to look it its going to be hard for me to find out whats going on.

a programmer should know better than that.

go over to Cprogramming.com too and try to get help there, might not be enough room for you to print out your source here.
use Dim c As new ADODB.Connection
This problem is coming because you have not included the ADO Library in your project.
To do that, you have right click on the toolbox, and select the option Add Reference and from there you can select the ADO library whichever version is there on your system.
in VBA editor go to tools then look for References then check MS ADO 2.5 library or whatever ado version library you want to use. good luck!

Back to QA. TechInterviews.com. Powered by Yahoo! Answers and TechInterviews.com community.