Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Unanswered: Between [Enter the Start Date] And [Enter the End Date])

    Hi all can you help me please, I need the users to be able to enter in a date for a self generating report. Usually I use the @Enter_Date but I need them to be able to enter a start date and a end date
    But when I run this query SQL gives me an error message
    Code:
    Server: Msg 207, Level 16, State 3, Line 1
    Invalid column name 'Enter the Start Date'.
    Server: Msg 207, Level 16, State 1, Line 1
    Invalid column name 'Enter the End Date'.
    What should use in place of BETWEEN [Enter the Start Date] And [Enter the End Date]??


    Code:
    SELECT [Main Table].[IR Number], [Main Table].Date, [Main Table].Inspector, [Main Table].Area, [Main Table].Violation, [Main Table].[Violation Type], [Main Table].Loss, [Main Table].[Loss Type], [Main Table].Employee, [Main Table].Action, [Main Table].[Action Type], [Main Table].Notes
    FROM [Main Table]
    WHERE ((([Main Table].Date) Between [Enter the Start Date] And [Enter the End Date]))
    ORDER BY [Main Table].[IR Number]

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Is it possible for your front end to ask for the inputs? Then you could just supply both dates as parameters to a sproc.
    Inspiration Through Fermentation

  3. #3
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Hi Redneck

    My front end is an Access 2003 an MDB, I need to change it to a ADP but Jet SQL and MSSQL dont exactly speak the same language

  4. #4
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Sure they do, I use pass-through queries all the time.

    I use code to get my parameter values from the user, and then change the
    QueryDef.SQL on the fly.

    Start a new query, then go to Query -> Sql Specific -> Pass-Through

    Then for your SQL
    Execute YourSproc "paramvalue1", "paramvalue2"
    Inspiration Through Fermentation

  5. #5
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Talking Finally Hoooorraaayyyy

    YESSSS

    Code:
    SELECT     [IR Number], Date, Inspector, Area, Violation, [Violation Type], Loss, [Loss Type], Employee, Action, Notes, [Action Type]
    FROM         dbo.[Main Table]
    WHERE     (Date BETWEEN @StartDate AND @EndDate)
    ORDER BY [IR Number]
    I'M SO HAPPY IT WORKS FINALLY HOOOORRAAAAYYYYY


    HAPPY DANCE!!!!!!!!!!!!!!!!!!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •