connection string

philfer

Registered User.
Local time
Today, 15:49
Joined
Dec 15, 2008
Messages
29
When working in VBA is a connection string really necessary, even a simple one like CurrentProject.Connection.

In Excel VBA assumes you are working with the current file

Is it necessay to have a connection string every time in Access

Thanks
Phil
 
When working in VBA is a connection string really necessary, even a simple one like CurrentProject.Connection.

In Excel VBA assumes you are working with the current file

Is it necessay to have a connection string every time in Access

Thanks
Phil
For ADO, yes you need to specify a connection and most of the time you can just use CurrentProject.Connection. In fact, if you try to open another connection to the same database you are currently in, without using the CurrentProject.Connection connection, you will find yourself getting an error about the database already being in use.
 
Bob,

What is the distinction between ADO and DAO as with DAO you can use:

Code:
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Set db = CurrentDb

I do use ADO for ASP but I never really understood the difference. Or to put it another way, I was just pleased to get it to work!

Simon
 
Simon,

Both ADO and DAO are data access technology. The differences is in how they were designed and their purposes were for. With DAO, it was originally used for ISAMs including Jet, Paradox and FoxPro, but over the time became heavily optimized for Jet engine. With ADO, it was to be 'universal' as possible and provide extra flexibility in how you can get data and as such is usable with wider variety of data stores from MS SQL Server, Oracle, MySQL, Access, and even with OLE DB, non RDBMS stores such as Excel.

Generally, I'd use DAO for Jet processing and ADO for interaction with SQL Server or different back-end. You can use both, in fact, as long you disambiguate.

HTH.
 

Users who are viewing this thread

Back
Top Bottom