Question : SQL between dates if empty choose all dates

So I have the SQL statement below, if the user puts in two dates it works fine. But I want it to query all the records in the table if nothing is put in the startDate and endDate fields on my form. Is that possible to do? Thanks for any help you can give me.

1:
2:
3:
4:
5:
6:
SELECT TOP 10 Sum([Scrapped _Material]+[Scrapped _Labor]+[Scrapped _Burden]) AS Expr1, Scrap.[_Reason], Scrap.Transaction_Date INTO ScrapByTool
FROM Scrap
WHERE (((Scrap.[_Tool])=[Forms]![ScrapAnalysis]![cboTool]))
GROUP BY Scrap.[_Reason], Scrap.Transaction_Date
HAVING (((Scrap.Transaction_Date)>=Forms!ScrapAnalysis!startDate And (Scrap.Transaction_Date)<Forms!ScrapAnalysis!endDate+1))
ORDER BY Sum([Scrapped _Material]+[Scrapped _Labor]+[Scrapped _Burden]) DESC;

Answer : SQL between dates if empty choose all dates

My mistake:

SELECT TOP 10 Sum([Scrapped _Material]+[Scrapped _Labor]+[Scrapped _Burden]) AS Expr1, Scrap.[_Reason], Scrap.Transaction_Date INTO ScrapByTool  
FROM Scrap  
WHERE (((Scrap.[_Tool])=[Forms]![ScrapAnalysis]![cboTool]))  
GROUP BY Scrap.[_Reason], Scrap.Transaction_Date  
HAVING  
((Scrap.Transaction_Date>=Forms!ScrapAnalysis!startDate) or  Forms!ScrapAnalysis!startDate is null)  
And  
((Scrap.Transaction_Date<Forms!ScrapAnalysis!endDate+1) or Forms!ScrapAnalysis!endDate is null)  
ORDER BY Sum([Scrapped _Material]+[Scrapped _Labor]+[Scrapped _Burden]) DESC;
Random Solutions  
 
programming4us programming4us