Accessing a query in VBA doesn't give me the query data

C

Charlie

Why is it when I open a query in VBA it doesn't sort and filter like my query
shows? It accesses all the fields in the table, rather than just the ones I
have queried. And it sort them as they are in the table, not as I have them
in the query. Here how I access the query.
Dim Record As ADODB.Recordset
Set Record = New ADODB.Recordset
Record.Open ContactQuery, CurrentProject.Connection, adOpenKeyset,
adLockPessimistic, adcmdquery

When I do a For each field in... command it doesn't just show the fields
I've queried, but all the fields in the table???
thanks,
charlie (CK)
 
V

Van T. Dinh

Perhaps, The "Output All Fields" Property of the Query has been set to True
/ Yes.

Check this Property in the DesignView of your Query.
 
Top