What do you mean by choose?
I do it all the time. Maybe you did not close a connection. If you post some code, we may be able to see what is wrong.
e.g.
Sub ADO()
' Set Reference in Tools to: Microsoft ActiveX Data Objects 2.x Library
Dim DBFullName As String
Dim Cnct As String, Src As String
Dim Connection As ADODB.Connection
Dim Recordset As ADODB.Recordset
Dim Col As Integer, Row As Long, s As String
' Database information
DBFullName = ActiveWorkbook.Path & "\NWind2003.mdb"
'Exit?
If Dir(DBFullName) = "" Then Exit Sub
'Clear any existing data from activesheet
Cells.Clear
' Open the connection
Set Connection = New ADODB.Connection
Cnct = "Provider=Microsoft.Jet.OLEDB.4.0; "
Cnct = Cnct & "Data Source=" & DBFullName & ";"
Connection.Open ConnectionString:=Cnct
' Create RecordSet
Set Recordset = New ADODB.Recordset
' Record locking
Recordset.CursorType = adOpenKeyset
Recordset.LockType = adLockOptimistic
With Recordset
' Filter
'Src = "SELECT * FROM Products WHERE ProductName = 'Watch' "
'Src = Src & "and CategoryID = 30"
Src = "SELECT Orders.CustomerID, Orders.OrderDate " & _
"FROM Orders " & _
"WHERE (((Orders.OrderDate) " & _
"Between #8/1/1994# and #8/30/1994#))"
Recordset.Open Source:=Src, ActiveConnection:=Connection
' Write the field names
For Col = 0 To .Fields.Count - 1
Range("A1").Offset(0, Col).Value = Recordset.Fields(Col).Name
Next Col
' Write the recordset
Range("A1").Offset(1, 0).CopyFromRecordset Recordset
Dim a As Variant
.MoveFirst
a = Recordset.GetRows
MsgBox LBound(a), , UBound(a)
MsgBox a(0), , a(1)
If .RecordCount < 1 Then GoTo endnow
.MoveFirst
For Row = 0 To (.RecordCount - 1)
'Debug.Print CStr(.Fields(Row).Value)
.MoveNext
Next Row
End With
endnow:
Set Recordset = Nothing
Connection.Close
Set Connection = Nothing
End Sub
Bookmarks