To return a single value use DLookup function.
sVal = DLookup("[col1]","table1","[col2]=1"
To Open a table from code use the DoCmd OpenTable method.
DoCmd.OpenTable "table1", acViewPreview
To open an ADO recordset in VB code use the RecordSet Open method.
Dim cnn1 As ADODB.Connection
Dim rstEmployees As ADODB.Recordset
Dim strCnn As String
Dim varDate As Variant
' Open connection.
strCnn = "Provider=sqloledb;" & _
"Data Source=srv;Initial Catalog=Pubs;User Id=sa;Password=; "
Set cnn1 = New ADODB.Connection
cnn1.Open strCnn
' Open employee table.
Set rstEmployees = New ADODB.Recordset
rstEmployees.CursorType = adOpenKeyset
rstEmployees.LockType = adLockOptimistic
rstEmployees.Open "employee", cnn1, , , adCmdTable Terry Broadbent
Please review faq183-874.
"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin