Use seek method in Recordset
Sub UsingSeek()
Dim rs As ADODB.Recordset
Dim conn As ADODB.Connection
Dim strSQL As String
Set rs = New ADODB.Recordset
Set conn = CurrentProject.Connection
With rs
.Open Source:="Customers", ActiveConnection:=conn, _
CursorType:=adOpenKeyset, LockType:=adLockOptimistic, _
Options:=adCmdTableDirect
.Index = "CompanyName"
.Seek ("T")
End With
Debug.Print rs!CompanyName & " " & rs!ContactTitle & " " & rs!ContactName
End Sub
Related examples in the same category