title: How to work around or to remedy Error: Invalid Use of Null?
body: <p>In this piece of MS Access Code I am trying to get the MAX Date of a Customer signup. First I have to convert the date so it can work with an aggregate function. Unfortunately there are areas in the date column that are null.</p>
  
  <p>I am getting the error <em>Invalid use of null</em> due to some records missing dates.</p>
  
  <p>How can I remedy that, is there a work around?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>SELECT CUSTOMER.FIRST_NAME, 
      MAX(DateSerial(CInt(Left([CUSTOMER.SIGNUP_DATE],4)),CInt(Mid([CUSTOMER.SIGNUP_DATE],5,2)),CInt(Right([CUSTOMER.SIGNUP_DATE],2)))) AS SIGN_DATE, 
      (DateSerial(CInt(Left([CUSTOMER.LEAVE_DATE],4)),CInt(Mid([CUSTOMER.LEAVE_DATE],5,2)),CInt(Right([CUSTOMER.LEAVE_DATE],2)))) AS LEV_DATE
  FROM CUSTOMER
  WHERE ((DateSerial(CInt(Left([CUSTOMER.SIGNUP_DATE],4)),CInt(Mid([CUSTOMER.SIGNUP_DATE],5,2)),CInt(Right([CUSTOMER.SIGNUP_DATE],2)))) &lt;=Date())
      AND ((DateSerial(CInt(Left([CUSTOMER.LEAVE_DATE],4)),CInt(Mid([CUSTOMER.LEAVE_DATE],5,2)),CInt(Right([CUSTOMER.LEAVE_DATE],2)))) =#012/31/2012#)
  GROUP BY
      CUSTOMER.FIRST_NAME,
      CUSTOMER.SIGNUP_DATE,
      CUSTOMER.LEAVE_DATE;
  </code></pre>