I don´t know whats wrong with this query... I want to know how many records are on another query named: Querie_Planilla
that have the following characteristics:
- The date on the field
PeriodoInicial
has to be greater or equal to the date[FechaInicio]
but a year ago - The date on the field
PeriodoFinal
has to be smaller to the value[FechaInicio]
(Both of this conditions consider the first day of the month inFechaInicio
- It has to have the same ID im looking for:
PlazaID = [Vacaciones]![PlazaID]
Here is the code:
DCount("PlazaID","Querie_Planilla","PeriodoInicial >= #" & DateSerial(DatePart("yyyy",[FechaInicio])-1,
DatePart("m",[FechaInicio]),1) & "# AND PeriodoFinal < #" & DateSerial(DatePart("yyyy",[FechaInicio]),
DatePart("m",[FechaInicio]),1) & "# AND PlazaID = '" & [Vacaciones]![PlazaID] & "'")
Right now its returning 0 but at least i have 3 for each ID