Rocky Smolin
rockysmolin at bchacc.com
Thu Oct 8 16:17:34 CDT 2009
I think so. Suppose I have a report based no a fairly complex query. In the form which calls the report I have a customer ID, a reporting quarter, a reporting year, and a class of merchandise - all selectable by the user depending on what they want the contents of the report to be. So in the query I would have four criteria. Normally I would go to the SQL view of the query, paste that into the report's Open event as the Me.RecordSource, and modify it adding WHERE clauses or, in the case of a summation query HAVING clauses to get the filtered recordset the user wants on the report. But isn't there a way to modify that stored query in code adding those criteria and using the modified query as the record source of the report? R -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Thursday, October 08, 2009 1:56 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] It's About Time I Learned This Are you talking about modifying the SQL property of the querydef in code? Charlotte Foust -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin Sent: Thursday, October 08, 2009 1:43 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] It's About Time I Learned This Dear List: When I have a query that is the source of a form, report or recordset that needs to have criteria of parameters, I always go to the SQL view of the query, copy out the code, paste it into the CBF, and add the parameters there - values from a text box or combo box, etc. Always done it that way. But I think there's a way to do modify a stored query in code using the querydef. Pretty basic Access stuff, I think, but I've never learned it. Can someone point me to a tutorial or primer or help screen explaining this? MTIA Rocky Smolin Beach Access Software 858-259-4334 www.e-z-mrp.com www.bchacc.com -- 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