Ok, so here is what I HAD written expecting your two dates. That is now a little incorrect.
Code:
Dim Anfang As Date, Ende As Date
Anfang = DateSerial(Year([Forms]![foLohnabrechnungMonat]![Startdatum](i)), Month([Forms]![foLohnabrechnungMonat]![Startdatum](i)) - 1, 1)
Ende = DateSerial(Year([Forms]![foLohnabrechnungMonat]![Startdatum](i)), Month([Forms]![foLohnabrechnungMonat]![Startdatum](i)), 0)
However we can now get away with just
Code:
Dim Anfang As Date, Ende As Date
Anfang = DateSerial(Year(Date), Month(Date) - 1, 1)
Ende = DateSerial(Year(Date), Month(Date), 0)
Now in your query you use
Code:
Datum BETWEEN Anfang AND Ende
or
Code:
Datum >= Anfang and Datum < = Ende
Or use the DateSerial() directly in the query, up to you.
All the above written in Notepad BTW
The key to all this is UNDERSTANDING the code/logic.
HTH