R
RCGUA
I have a table named tblEquipment with two columns, the first column
has date and the column is named MachineDate the second column has
a location number and the column is named MachineLocationNumber I
have two variables stDate represents the date and stLocation is for
the MachineLocationNumber. I can find records that match the date
and records that match the location number, but the DCount below (the
third one) shows zero even when there is a record in the table that
matches -both- the stDate and stLocation
==== The first DCount code below works and it counts the number of
records in the table that match the stDate variable.
The second DCount code below works and it counts the number of records
in the table that match the stLocation variable.
The third always counts zero. ===========
If DCount("*", "tblEquipment", "[MachineDate] = #" & stDate & "#") > 0
Then
MsgBox "greater than zero"
End If
If DCount("*", "tblEquipment", [MachineLocationNumber] = stLocation) >
0 Then
MsgBox "greater than zero"
End If
If DCount("*", "tblEquipment", [MachineLocationNumber] = stLocation +
"[MachineDate] = #" & stDate & "#") > 0 Then
MsgBox "greater than zero"
End If
has date and the column is named MachineDate the second column has
a location number and the column is named MachineLocationNumber I
have two variables stDate represents the date and stLocation is for
the MachineLocationNumber. I can find records that match the date
and records that match the location number, but the DCount below (the
third one) shows zero even when there is a record in the table that
matches -both- the stDate and stLocation
==== The first DCount code below works and it counts the number of
records in the table that match the stDate variable.
The second DCount code below works and it counts the number of records
in the table that match the stLocation variable.
The third always counts zero. ===========
If DCount("*", "tblEquipment", "[MachineDate] = #" & stDate & "#") > 0
Then
MsgBox "greater than zero"
End If
If DCount("*", "tblEquipment", [MachineLocationNumber] = stLocation) >
0 Then
MsgBox "greater than zero"
End If
If DCount("*", "tblEquipment", [MachineLocationNumber] = stLocation +
"[MachineDate] = #" & stDate & "#") > 0 Then
MsgBox "greater than zero"
End If