The only thing I can see is that
FemcoPMLogData has a time associated with the date =>> 6/10/2021 12:31:53 PM
DoosanPMLogData does not have a time associated with the date =>> 6/10/2021
Even though the time is not displayed, in DoosanPMLogData the actual data in the field "PerformedOn" (type date/time) is #6/10/2021 12:00:00AM#[FONT=Calibri]
For the query, FemcoPMQuery, using MachineTextBox = 1 and DateTextBox = #6/10/2021#, the DCount results in 0 because there is no date/time record that is equal to #6/10/2021 12:00:00 AM#.
If you change the VBA from
Code:
MsgBox "Number of dates that match: " & DCount("[ID]", QuerySource, "[PerformedOn] = #" & DateToCheck & "#")
to
Code:
MsgBox "Number of dates that match: " & DCount("[ID]", QuerySource, "[PerformedOn] > #" & DateToCheck & "#")
or
Code:
MsgBox "Number of dates that match: " & DCount("[ID]", QuerySource, "[PerformedOn] >= #" & DateToCheck & "#")
the DCount msgbox is "Number of dates that match: 4"