Need help with following Query where User enters a Location Number and Records for that location are returned. Line 1 & line 2 criteria work if the location requested matches the beginning Location or ending location but I can not get line 3 criteria to return records where the requested location is a number between {LOC1) and LOC2 which is calculated as ])<([LOC1]+[RECV]+[FILMIN]-[DISPOSE]-[RETURN]-1)
This is the SQL view of what I have so far.
SELECT DEPT1F.DEPARTMENT, DEPT1F.DeptNo, DEPT1F.LIAISON, RCMGT.ID, RCMGT.TransferNo, RCMGT.ContactPerson, RCMGT.DeptNo, RCMGT.SubDept, RCMGT.BOX1, RCMGT.BOX2, RCMGT.MICRO1, RCMGT.MROLL1, RCMGT.MICRO2, RCMGT.MROLL2, RCMGT.VOLUME, RCMGT.ItemNo, RCMGT.SITE, RCMGT.YEAR1, RCMGT.YEAR2, RCMGT.FORM, RCMGT.ARCH, RCMGT.RYEAR, RCMGT.BOXLABEL, RCMGT.DESCRIBE, RCMGT.RECV, RCMGT.RECV_YR, RCMGT.FILMIN, RCMGT.FILMIN_YR, RCMGT.FILMED, RCMGT.FILMED_YR, RCMGT.RETURN, RCMGT.RETURN_YR, RCMGT.DISPOSE, RCMGT.DISPOSE_YR, RCMGT.COMMENT, RCMGT.INDEXED, RCMGT.INDEX, RCMGT.BOXOUT, RCMGT.SENTTO, RCMGT.DATEOUT, RCMGT.LASTUPDATE, RCMGT.ReturnPriortoDisposal, RCMGT.ScheduleName, RCMGT.DateReceived, RCMGT.STATUS, [RECV]+[FILMIN]-[DISPOSE]-[RETURN] AS STORED, RCMGT.LOC1, [LOC1]+[RECV]+[FILMIN]-[DISPOSE]-[RETURN]-1 AS LOC2, [YEAR2]+[RYEAR] AS TARGET
FROM RCMGT LEFT JOIN DEPT1F ON RCMGT.DeptNo = DEPT1F.DeptNo
WHERE (RCMGT.LOC1)=[enter Loc no])
OR([LOC1]+[RECV]+[FILMIN]-[DISPOSE]-[RETURN]-1)=[enter Loc no])
OR ((RCMGT.LOC1)<[enter Loc no]) AND (([LOC1]+[RECV]+[FILMIN]-[DISPOSE]-[RETURN]-1)>[enter Loc no]) AND (([enter Loc no])>[LOC1] And ([enter Loc no])<([LOC1]+[RECV]+[FILMIN]-[DISPOSE]-[RETURN]-1)));
This is the SQL view of what I have so far.
SELECT DEPT1F.DEPARTMENT, DEPT1F.DeptNo, DEPT1F.LIAISON, RCMGT.ID, RCMGT.TransferNo, RCMGT.ContactPerson, RCMGT.DeptNo, RCMGT.SubDept, RCMGT.BOX1, RCMGT.BOX2, RCMGT.MICRO1, RCMGT.MROLL1, RCMGT.MICRO2, RCMGT.MROLL2, RCMGT.VOLUME, RCMGT.ItemNo, RCMGT.SITE, RCMGT.YEAR1, RCMGT.YEAR2, RCMGT.FORM, RCMGT.ARCH, RCMGT.RYEAR, RCMGT.BOXLABEL, RCMGT.DESCRIBE, RCMGT.RECV, RCMGT.RECV_YR, RCMGT.FILMIN, RCMGT.FILMIN_YR, RCMGT.FILMED, RCMGT.FILMED_YR, RCMGT.RETURN, RCMGT.RETURN_YR, RCMGT.DISPOSE, RCMGT.DISPOSE_YR, RCMGT.COMMENT, RCMGT.INDEXED, RCMGT.INDEX, RCMGT.BOXOUT, RCMGT.SENTTO, RCMGT.DATEOUT, RCMGT.LASTUPDATE, RCMGT.ReturnPriortoDisposal, RCMGT.ScheduleName, RCMGT.DateReceived, RCMGT.STATUS, [RECV]+[FILMIN]-[DISPOSE]-[RETURN] AS STORED, RCMGT.LOC1, [LOC1]+[RECV]+[FILMIN]-[DISPOSE]-[RETURN]-1 AS LOC2, [YEAR2]+[RYEAR] AS TARGET
FROM RCMGT LEFT JOIN DEPT1F ON RCMGT.DeptNo = DEPT1F.DeptNo
WHERE (RCMGT.LOC1)=[enter Loc no])
OR([LOC1]+[RECV]+[FILMIN]-[DISPOSE]-[RETURN]-1)=[enter Loc no])
OR ((RCMGT.LOC1)<[enter Loc no]) AND (([LOC1]+[RECV]+[FILMIN]-[DISPOSE]-[RETURN]-1)>[enter Loc no]) AND (([enter Loc no])>[LOC1] And ([enter Loc no])<([LOC1]+[RECV]+[FILMIN]-[DISPOSE]-[RETURN]-1)));