Trying to run a rather simple query to fill a report in MS Access but its kicking back this error. It is supposed to select all records where MRC is TRUE between these 2 dates.
It works just fine when dbo_Project_Master.MRC IS NOT NULL but trying to assign any value to it causes the error. MRC is a bit type so I thought I'd be able to assign '1' to it and use that since SQL doesn't recognize boolean types.
SELECT
dbo_Project_Master.ProjectID, dbo_Project_Master.Project_Name, dbo_Project_Master.Permit_Num, dbo_Municipality.Municipality, dbo_Project_Master.MRC, dbo_Project_Master.Date_Received
FROM
(dbo_Project_Master INNER JOIN dbo_Project_Municipality ON dbo_Project_Master.ProjectID = dbo_Project_Municipality.ProjectID) INNER JOIN dbo_Municipality ON dbo_Project_Municipality.MunicipalityID = dbo_Municipality.MunicipalityID
WHERE
(dbo_Project_Master.Date_Received >= Forms!frmCriteriaAnnualRpt!txtStartDate) AND (dbo_Project_Master.Date_Received <= Forms!frmCriteriaAnnualRpt!txtEndDate) AND (dbo_Project_Master.MRC = '1');
'1'
<> 1
. With the single quotes it is a text. Without the single quotes it is a number, or here a bit.
Write dbo_Project_Master.MRC = 1
(without the quotes). Or even better dbo_Project_Master.MRC <> 0
because Access True
is translated to -1
. So <> 0
catches both 1
and -1
.
And btw., here = is not an assignment but a comparison.