JMoss
jmoss111 at bellsouth.net
Thu Jun 17 18:11:32 CDT 2004
Jim, Thanks for your answer, but what I'm doing in using a distinct value companyid from the first query which is the recordsource to a recordset which I'm moving through one record at a time in an outer loop to supply the parameter for the second recordset in an inner loop which has several departments per companyid. Then I use the second recordset to populate and build Excel spreadsheets via automation. Since I cant use a variable as a parameter, I created a function to get the data and used the function as the select's parameter. Anyway, it's working. Jim -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Hale, Jim Sent: Thursday, June 17, 2004 10:52 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] How to set a value from one recordset as a parameter for a select statement that is source to another recordset It sounds to be that you need to use the first query as a sub query of the second. To do this copy the sql of the first query, put brackets around it, and paste it into the criteria line of the appropriate field of the second query. As long as the first query is only returning one "answer" ie one field of one record, it should work. Good luck Jim Hale -----Original Message----- From: JMoss [mailto:jmoss111 at bellsouth.net] Sent: Wednesday, June 16, 2004 8:05 PM To: Accessd at Databaseadvisors.Com Subject: [AccessD] How to set a value from one recordset as a parameter for a select statement that is source to another recordset Is there a way to do this? I have select distinct COID statement as source for a recordset that I'm looping through, and want to use the distinctly selected COID as a parameter in a select statement that is recordsource for another recordset that I'm using to create Excel files. Thanks in advance for any help! Jim -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com