Charlotte Foust
charlotte.foust at gmail.com
Tue Oct 23 20:27:16 CDT 2012
Arthur, To use a querydef, you have to instantiate a querydef object and then use the OpenRecordset of the querydef object to return the recordset. So ... (Air Code) Dim rst As DAO.Recordset Dim qdf as DAO.Querydef <code here> Set rst = qdf.OpenRecordset Charlotte On Tue, Oct 23, 2012 at 2:01 PM, Arthur Fuller <fuller.artful at gmail.com>wrote: > 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 > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >