I've tried to implement this sub, but it seems that I'm needing a namespace or...?
Code:Sub ADOFilterRecordset() Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset ' Open the connection cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=.\NorthWind.mdb;" ' Open the recordset rst.Open "Customers", cnn, adOpenKeyset, adLockOptimistic ' Filter the recordset to include only those customers in ' the USA that have a fax number rst.Filter = "Country='USA' And Fax <> Null" Debug.Print rst.Fields("CustomerId").Value ' Close the recordset rst.Close End Sub


Reply With Quote