A family of Microsoft relational database management systems designed for ease of use.
You haven't given us much to go on, but assuming for simplicity that you have only two tables, Clients and Services, related on ClientID, then the query would be along these lines:
SELECT FirstName, LastName, Address, City, HomePhone, CellPhone
MIN(ServiceDate) AS FirstService,
COUNT(*) AS TotalTrips,
SUM(IIF(ServiceType = "Repair",1,0)) AS TotalRepairs,
SUM(Hours) AS TotalHours
FROM Clients INNER JOIN Services ON Clients.ClientID = Services.ClientID
WHERE AcctYear(ServiceDate,7,1) = AcctYear(DATE(),7,1)
GROUP BY FirstName, LastName, Address, City, HomePhone, CellPhone;
The query calls the following function, which returns the accounting year for the date passed into the function:
Public Function AcctYear(DateVal As Date, MonthStart As Integer, DayStart As Integer) As String
Dim dtmYearStart As Date
If MonthStart = 1 And DayStart = 1 Then
' accounting year is calendar year, so return single year value
AcctYear = Year(DateVal)
Else
' get start of accounting year in year of date value
dtmYearStart = DateSerial(Year(DateVal), MonthStart, DayStart)
' if date value is before start of accounting year
' accounting year starts year previous to date's year,
' otherwise it starts with date's year
If DateVal < dtmYearStart Then
AcctYear = Year(DateVal) - 1 & Format(Year(DateVal) Mod 100, "-00")
Else
AcctYear = Year(DateVal) & Format((Year(DateVal) + 1) Mod 100, "-00")
End If
End If
End Function