[AccessD] force Null date/time data type value

Susan Harkins ssharkins at bellsouth.net
Fri Oct 3 09:01:33 CDT 2003


I tried inserting Null and it didn't seem to work -- but let me try again! ;) I want to avoid changing the actual structure, because some records will have a date, some won't -- but that is an option I've considered, but am hoping to avoid if possible. Thanks!

Susan H. 


  Susan,

      Let the table T_Books consist of fields Author(text), Title(text) and RefDate(date type). Both the following statements will append a record having Null value in the date field -

      (a) If default value of RefDate is not Null -
          DoCmd.RunSQL "INSERT INTO  T_Books " & _
                  "(Author, Title, RefDate)  " & _
                  "Values('AAA',  'TTT' , Null) ;"

      (b) If default value of RefDate is already set as Null -    
          DoCmd.RunSQL "INSERT INTO  T_Books " & _
              "(Author, Title)  " & _
              "Values('AAA',  'TTT') ;"

  Regards,
  A.D.Tejpal
  --------------
    ----- Original Message ----- 
    From: Susan Harkins 
    To: AccessD at databaseadvisors.com 
    Sent: Friday, October 03, 2003 06:16
    Subject: [AccessD] force Null date/time data type value


    I'm using INSERT INTO to append records. When a text string isn't
    appropriate, I can use a zero-length string, but not the dates -- I've found
    no way to force a Null value using INSERT INTO. Any help?

    Susan H.



------------------------------------------------------------------------------


  _______________________________________________
  AccessD mailing list
  AccessD at databaseadvisors.com
  http://databaseadvisors.com/mailman/listinfo/accessd
  Website: http://www.databaseadvisors.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20031003/1d95c4de/attachment-0001.html>


More information about the AccessD mailing list