+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : Is Null and dates

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Is Null and dates

    I would much appreciate help on my problem.
    I am retrieving data form Sage line 100 using an ODBC link.
    One of the fields (columns) Is INVOICE_DATE and I need to select records when two criteria are matched.
    Firstly when the INVOICE_DATE is greater than 3 days less than the current date
    OR
    Secondly when there is no INVOICE_DATE in the Sage file
    I had hoped to achieve this using something like this in the MS Query grid
    Field INVOICE_DATE
    !st Criterion : DateDiff("d",date,INVOICE_DATE)<4
    2nd Criterion :Is Null
    My main suprise is that the 2nd criterion didn't work.
    Nor did : ""
    I have tried a whole range of ideas like the above but all end either as "Syntax error" or a message "Cant find column".
    I have a work round by doing the selection in a worksheet, but this is an ineligant solution

    I hope somebody can find the time to point me in the right direction
    John S

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: Is Null and dates

    Are you able to post your SQL statement so that we can determine specifically where this is amiss?

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Is Null and dates

    Alan,
    I have been unable to write an SQL that works. What I am trying to do is to limit the information coming from SAGE to those orders that have not been invoiced (Hence no Invoice_Date or [INVOICE_DATE] is Null) plus those orders that have been invoiced in the last 4 days ([TodaysDate]-[INVOICE_DATE] <=4) . I thought you could use Now() to get todays date, but I can't and I haven't been able to find anything in the help system.
    The SQL string without these criteria is
    SELECT WMORDER.WM_INVOICE_DATE, WMORDER.WM_ACCOUNT, WMORDER.WM_ORDER_NO, WMLABEL.WL_JOB_DESC, WMLABEL.WL_JOB_NUMBER, WMLABEL.WL_MATERIAL, WMLABEL.WL_SPOT, WMLABEL.WL_QUANTITY, WMLABEL.WL_HEIGHT, WMLABEL.WL_WIDTH, WMORDER.WM_INVOICE_DATE
    FROM WINDMILL.WMLABEL WMLABEL, WINDMILL.WMORDER WMORDER
    WHERE WMORDER.THIS_RECORD = WMLABEL.PARENT_RECORD AND ((WMORDER.WM_STATUS>2) AND (WMLABEL.WL_PRINTED=1))

    I hope this is enough for you to be able to help
    John

  4. #4
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Is Null and dates

    Alansidman was kind enough to respond to my original request for help, but has lost touch since, can someone help please
    John

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1