E
efgh
I have a query that works when I put in the date but not when I put in the date field name from a form. What's odd about this is that I use the date field in the same query and it works fine there.
Here's the SQL:
SELECT [Latitude Rate Plans].Number, [Latitude Rate Plans].Type, [Latitude Data Units].Template, Count([Latitude Data Units].Unit) AS CountOfUnit INTO TempActiveUnitsTW
from [Latitude Data Units], [Latitude Rate Plans]
where [Latitude Rate Plans].Code = [Latitude Data Units].Template
and (([Latitude Data Units].InDate <= [Forms]![Main]![EDate]) and (([Latitude Data Units].TmDate >= [Forms]![Main]![EDate]) OR (([Latitude Data Units].TmDate) is Null)))
and (([Latitude Data Units].Template) Is Not Null)
GROUP BY [Latitude Rate Plans].Number, [Latitude Rate Plans].Type, [Latitude Data Units].Template
ORDER BY [Latitude Rate Plans].Type;
If I replace [Latitude Data Units].InDate <= [Forms]![Main]![EDate] with [Latitude Data Units].InDate <= #6/24/2006# which is the date entered in the form, it works fine and I get the results that I want. Any ideas as to what's wrong?
Here's the SQL:
SELECT [Latitude Rate Plans].Number, [Latitude Rate Plans].Type, [Latitude Data Units].Template, Count([Latitude Data Units].Unit) AS CountOfUnit INTO TempActiveUnitsTW
from [Latitude Data Units], [Latitude Rate Plans]
where [Latitude Rate Plans].Code = [Latitude Data Units].Template
and (([Latitude Data Units].InDate <= [Forms]![Main]![EDate]) and (([Latitude Data Units].TmDate >= [Forms]![Main]![EDate]) OR (([Latitude Data Units].TmDate) is Null)))
and (([Latitude Data Units].Template) Is Not Null)
GROUP BY [Latitude Rate Plans].Number, [Latitude Rate Plans].Type, [Latitude Data Units].Template
ORDER BY [Latitude Rate Plans].Type;
If I replace [Latitude Data Units].InDate <= [Forms]![Main]![EDate] with [Latitude Data Units].InDate <= #6/24/2006# which is the date entered in the form, it works fine and I get the results that I want. Any ideas as to what's wrong?