Report based on query programatically
Hey all - I want to generate a report programmatically based on an existing query, or alternatively on an SQL statement. The query is a little complex (this is copied from the Query's SQL view):
SELECT TESTS.facilityID, TESTS.testDate, TESTS.testTypeID, DateAdd("m",[testPeriod],[testDate]) AS DateDue
FROM FACILITIES INNER JOIN (TESTTYPES INNER JOIN TESTS ON TESTTYPES.testTypeID = TESTS.testTypeID) ON FACILITIES.facilityID = TESTS.facilityID
WHERE (((DateAdd("m",[testPeriod],[testDate])) Between Date() And DateAdd("m",3,Date())));
which is why I thought it would be easier to use the existing query.
So, how do I get the record source of the report to be the records returned by this query? ALternatively, how can I code this complex SQL statement into VBA?
Thank you
|