The below code uses DAO to query data from an Access database. The problem is that when my workbook loads, lots of these queries run one after the other and they make the load time too long. Is there a way to have queries run asynchronously? Meaning having multiple queries run at the same time as opposed to waiting for each query to finish before the next one starts? If this can't be done using DAO, then what are my other options?
Thanks!
Public Const MyDBPath As String = "\\MyDir\MyDB.accdb"
Sub ExampleSub()
Dim Db As DAO.Database
Dim Rs As DAO.Recordset
Set Db = DAO.dbengine.OpenDatabase(MyDBPath)
Set Rs = Db.OpenRecordset("SELECT id, name FROM person WHERE last = " & Chr(39) & Name & Chr(39), dbReadOnly)
'do stuff here
Rs.Close
Set Rs = Nothing
Db.Close
Set Db = Nothing
End Sub
Bookmarks