Results 1 to 4 of 4
  1. #1
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283

    Help

    Hey I'm having trouble with a query. I have fields Date_Recieved, and Date_Mailed. I want to run a query to show the customers who havent returned their surveys within 30 days. Also I have customers who don't have anything in the Date_Received field yet. I wrote this code but it doesn't work

    SELECT *
    FROM Customer


    WHERE [Date Received] is NULL AND [Date Mailed] > (Date() - 30);

    It just shows the null values in the field. Not the other ones where I have recieved the surveys that are 30 days or older.

    Also I tried
    Select * from Customer
    Where [Date Received] is NULL
    And [Date Received] - [Date Mailed] >30;

    And it comes up with nothing

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Try adding # around the dates.

    SELECT *
    FROM Customer
    WHERE #[Date Received]# is NULL AND #[Date Mailed]# > (Date() - 30);

    Dale
    FYI, Remove all spaces from your field names.
    Makes you database developing life a lot easier.

  3. #3
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    It says syntax error in date in query expression

  4. #4
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    Nevermind I figured it out. I used OR instead of AND

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums