1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

SQL in Access ignore Where clause

Discussion in 'Business Applications' started by cydlawenhau, Oct 7, 2008.

Thread Status:
Not open for further replies.
  1. cydlawenhau

    cydlawenhau Thread Starter

    Joined:
    Oct 7, 2008
    Messages:
    2
    I have a query which then drives a PivotChart reporting trend data.
    For the life of me, I can not see what is wrong with this query though. Whenever I run it, Access displays results that ignore the WHERE date limitations.
    If I remove the reference to the form and fill the data as a specific date the same thing happens.

    Code:
     
    SELECT MainEntry.ID, MainEntry.TaskNo, MainEntry.GeneratedOn, MainEntry.HandledOn, MainEntry.AgentHandled, MainEntry.AgentAbout, MainEntry.NPSScore, MainEntry.Category, MainEntry.Comment, MainEntry.FollowedUp
    FROM MainEntry
    WHERE (((FormatDateTime([MainEntry].[GeneratedOn],2))>=FormatDateTime([Forms]![MakeReports].[startDate],2) And (FormatDateTime([MainEntry].[GeneratedOn],2))<=FormatDateTime([Forms]![MakeReports].[endDate],2)))
    ORDER BY MainEntry.GeneratedOn;
    
    
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You use the syntax Between date1 AND date2, not ">=" and "<="
     
  3. cydlawenhau

    cydlawenhau Thread Starter

    Joined:
    Oct 7, 2008
    Messages:
    2
    Now you mention it, it's pretty obvious actually.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/756884

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice