I need to limit my query/report output to only include a 90-day date range of a field I call “Post-Date”. The ending date for that range is the last day of the month of a field I call “Period”. The first day of the date range is 90 days earlier then that date. The function below successfully returns the last day of the month for the Period field. However, when I try to use the function in my query criteria it doesn’t return anything. Just below the function, I’ve also pasted the date range criteria that I entered for my “Post-Date” field. The expression doesn’t return anything as is
This is my first go at using public functions in queries, so please be as detailed as possible in your response. Your help is greatly appreciated!
Public Function LastDayOfMonth(D As Date) As Date
Dim LDOM As Date
Dim NM As Date
NM = DateAdd("m", 1, D)
LDOM = DateSerial(Year(NM), Month(NM), "1")
LDOM = DateAdd("d", -1, LDOM)
LastDayOfMonth = LDOM
End Function
DATE RANGE CRITERIA:
Between DateAdd("d",-90,LastDayOfMonth([Period])) And LastDayOfMonth([Period])

This is my first go at using public functions in queries, so please be as detailed as possible in your response. Your help is greatly appreciated!
Public Function LastDayOfMonth(D As Date) As Date
Dim LDOM As Date
Dim NM As Date
NM = DateAdd("m", 1, D)
LDOM = DateSerial(Year(NM), Month(NM), "1")
LDOM = DateAdd("d", -1, LDOM)
LastDayOfMonth = LDOM
End Function
DATE RANGE CRITERIA:
Between DateAdd("d",-90,LastDayOfMonth([Period])) And LastDayOfMonth([Period])
