[AccessD] TableDefs vs. QueryDefs

Arthur Fuller fuller.artful at gmail.com
Tue Oct 23 16:01:39 CDT 2012


Apparently I mistakenly assumed that a TableDef and a QueryDef were
equivalent, and would respond identically. This seems not to be so.

I have a table called Peripherals, and a pair of queries based on it. Both
queries select all the fields explicitly (i.e. not *). One of them filters
the PeripheralType column to "LC"; the other filters it to "THC". Both
queries run fine by themselves.

<vba>
  Set rst = CurrentDb.TableDefs!Peripherals.OpenRecordset          ' this
line works fine
  Set rst = CurrentDb.QueryDefs!qryLCs.OpenRecordset                 ' this
one doesn't work at all
</vba>

What should the syntax be, to open a named query and create a recordset
from it?

TIA,
Arthur


More information about the AccessD mailing list