Wednesday, February 15, 2006

Using ADO inside Access

This took me a couple hours (three) to find an example of how to do this. I was wondering what to use on the connection string into the ADODB.Connection object. It turns out, it is not needed.

Dim adoConn As ADODB.Connection
Dim adoRS As New ADODB.Recordset

Set adoConn = CurrentProject.Connection
adoRS.Open "Query", adoConn, adOpenForwardOnly, adLockReadOnly, -1

Do While Not adoRS.EOF


Please note the CurrentProject.Connection, this seems to work.

What sucks is I have the full MSDN at my disposal and it took a Google search (roughly page five after going past who knows how many links to ads for books about programming Access using VBA) to figure this out.

No comments: