/*Create this user defined function on your database. Your query would then be:
SELECT <Table Fields>
FROM <Table>
WHERE <Sample Date> BETWEEN dbo.f_GetBaseDate(<User Input Data1>) AND dbo.f_GetBaseDate(<User Input Date2>)
*/
CREATE FUNCTION dbo.f_GetBaseDate ( @varDate...