Good afternoon all,
I am so frustrated because I know visually what I want but I cannot get it working in MS Access. I've got a function in SQL server which I need to use in MS Access. I tried translating it, but it didn't work out. Eventually found out you need a blank form, added a text box but now comes the real struggle; I need a button.
CREATE FUNCTION fnFietsAantDagenPerJaar
(
@Jaar AS int
)
RETURNS TABLE
AS
RETURN
SELECT f.Fiets_id, f.Fiets_Type, SUM(DATEDIFF(DAY, h.Huurovereenkomst_Begin_datum, h.Huurovereenkomst_Eind_datum)) AantalDagen
FROM Fiets f
INNER JOIN HuurovereenkomstFiets hf
ON hf.HuurovereenkomstFiets_Fiets_id = f.Fiets_id
INNER JOIN Huurovereenkomst h
ON h.Huurovereenkomst_id = hf.HuurovereenkomstFiets_Huurovereenkomst_id
WHERE YEAR(h.Huurovereenkomst_Begin_datum) = @Jaar AND YEAR(h.Huurovereenkomst_Eind_datum) = @Jaar
GROUP BY f.Fiets_id, f.Fiets_Type
GO
This is my SQL function, which works. Now I want a MS Access form which simple says:
<Year> [Enter]
Where the the year is a text box and the enter button should execute the function with the year are variable. Anyone that can get me going?