kevin_maher
New member
- Local time
- Tomorrow, 01:42
- Joined
- Aug 12, 2024
- Messages
- 11
Hi all, am hoping to get some help with this issue I'm facing, please.
I work for a private training organisation that trains the people that work in child care centres. We have a Business Manager who amongst other things tries to visit the centres on a regular basis. We have a spreadsheet of all the centres that I've imported into Access, with centre details in the t_Centres table (ID, Centre Name, Address, Suburb and Region plus a few other fields). The visits are in t_Visits (ID, Centre_ID, Date_visited, SpokeTo and Comments).
I am trying to create a report which will show the centres that were last visited 120+ days ago, and I've been able to get a query to work on its own (shown below),
SELECT SubQuery.Centre_ID, SubQuery.MaxOfDate_visited, SubQuery.[Centre Name], SubQuery.Suburb, SubQuery.Region
FROM (SELECT t_Visits.Centre_ID, Max(t_Visits.Date_visited) AS MaxOfDate_visited, t_Centres.[Centre Name], t_Centres.Suburb, t_Centres.Region FROM t_Centres INNER JOIN t_Visits ON t_Centres.ID = t_Visits.Centre_ID GROUP BY t_Visits.Centre_ID, t_Centres.[Centre Name], t_Centres.Suburb, t_Centres.Region) AS SubQuery
WHERE (((SubQuery.[MaxOfDate_visited])<=DateAdd("d",-120,Date())) AND ((SubQuery.[Region])=[Forms]![f_Reports]![cboRegion]))
ORDER BY SubQuery.[Centre Name];
,...but when put into a form (which is itself called from the Reports form after the user chooses the region from cboRegion, then the button they click next to it will launch that report), it asks for Date_visited... and whatever date gets entered is what is shown as the date on the report. If I leave it blank then there's no dates showing.
What I want it to give me is basically what you see below, with the date of the last visit showing alongside the centre instead of the 1/4/24 that I entered just now, please. As an exmple, if Centenary FDC had been visited on June 14th then it would not show on this report, and if C & K Taranganba was visited on April 18th then 18/04/24 would show up.
Let me know if I need to clarify anything further.
Kevin
I work for a private training organisation that trains the people that work in child care centres. We have a Business Manager who amongst other things tries to visit the centres on a regular basis. We have a spreadsheet of all the centres that I've imported into Access, with centre details in the t_Centres table (ID, Centre Name, Address, Suburb and Region plus a few other fields). The visits are in t_Visits (ID, Centre_ID, Date_visited, SpokeTo and Comments).
I am trying to create a report which will show the centres that were last visited 120+ days ago, and I've been able to get a query to work on its own (shown below),
SELECT SubQuery.Centre_ID, SubQuery.MaxOfDate_visited, SubQuery.[Centre Name], SubQuery.Suburb, SubQuery.Region
FROM (SELECT t_Visits.Centre_ID, Max(t_Visits.Date_visited) AS MaxOfDate_visited, t_Centres.[Centre Name], t_Centres.Suburb, t_Centres.Region FROM t_Centres INNER JOIN t_Visits ON t_Centres.ID = t_Visits.Centre_ID GROUP BY t_Visits.Centre_ID, t_Centres.[Centre Name], t_Centres.Suburb, t_Centres.Region) AS SubQuery
WHERE (((SubQuery.[MaxOfDate_visited])<=DateAdd("d",-120,Date())) AND ((SubQuery.[Region])=[Forms]![f_Reports]![cboRegion]))
ORDER BY SubQuery.[Centre Name];
,...but when put into a form (which is itself called from the Reports form after the user chooses the region from cboRegion, then the button they click next to it will launch that report), it asks for Date_visited... and whatever date gets entered is what is shown as the date on the report. If I leave it blank then there's no dates showing.
What I want it to give me is basically what you see below, with the date of the last visit showing alongside the centre instead of the 1/4/24 that I entered just now, please. As an exmple, if Centenary FDC had been visited on June 14th then it would not show on this report, and if C & K Taranganba was visited on April 18th then 18/04/24 would show up.
Let me know if I need to clarify anything further.
Kevin