oni29
05-29-2007, 03:55 PM
I'm working on some custom Excel functions. They extract data from a Microsoft Access 2002 database. The database is located on a shared Network drive in Windows.
What is the best method of extracting the information? At the moment I'm using DAO. The code looks something like:
Const DBPATH = "C:\Path to database\database.mdb"
Dim strSql As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
strSql = "this is where I put the sql"
Set db = OpenDatabase(DBPATH)
Set rs = db.OpenRecordset(strSql, dbReadOnly)
Extract values returned in rs & do something with them here
rs.Close
Set rs = Nothing
Set db = Nothing
The code in general does the following
Accesses the same database each time
Runs select query (read only access to database)
Does something with the records that are returned (1-2 records on average)
What is the best method of extracting the information? At the moment I'm using DAO. The code looks something like:
Const DBPATH = "C:\Path to database\database.mdb"
Dim strSql As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
strSql = "this is where I put the sql"
Set db = OpenDatabase(DBPATH)
Set rs = db.OpenRecordset(strSql, dbReadOnly)
Extract values returned in rs & do something with them here
rs.Close
Set rs = Nothing
Set db = Nothing
The code in general does the following
Accesses the same database each time
Runs select query (read only access to database)
Does something with the records that are returned (1-2 records on average)