locked
Need all data for range of dates in a view RRS feed

  • Question

  • I am using SQL Server 2008 with a Microsoft Access 2010 data project.  I need the user to be able to use a date picker in a form in access that retrieves all data within the selected range of dates from a view in the sql server in order to populate a report.  I would like to use the forms date inputs and pass them along to a stored procedure that retrieves the desired data within the range of dates from the view and return that data to be used in a report.  Would anyone be able to help write the stored procedure that would do this? Or have any other suggestions that might work better? I am relatively new to VB and have only had limited experience using SQL Server.

    Jeff E

    Wednesday, June 20, 2012 2:02 PM

Answers

  • Use query similar to this:

    CREATE PROCEDURE MyProc
    @start datetime,
    @end datetime
    AS
    BEGIN
    select * from mytable
    where DateColumn between @start and @end
    END
    GO
    • Marked as answer by jce5060 Wednesday, June 20, 2012 3:07 PM
    Wednesday, June 20, 2012 2:33 PM

All replies

  • Use query similar to this:

    CREATE PROCEDURE MyProc
    @start datetime,
    @end datetime
    AS
    BEGIN
    select * from mytable
    where DateColumn between @start and @end
    END
    GO
    • Marked as answer by jce5060 Wednesday, June 20, 2012 3:07 PM
    Wednesday, June 20, 2012 2:33 PM
  • Thank you

    Jeff E

    Wednesday, June 20, 2012 3:07 PM