[AccessD] force Null date/time data type value

A.D.Tejpal adtp at touchtelindia.net
Fri Oct 3 11:50:36 CDT 2003


Susan,

    Apparently you are yet to try out the suggestions. It would be nice if you could kindly do so and  then  confirm the outcome.

    It may kindly be noted that there is no need at all to worry about  changing the structure of data table. If you  know  that the table does not carry any default value in the date field, go for the simpler statement i.e. (b). If in any doubt, stick to the one at (a) which is effective in all cases.

Regards,
A.D.Tejpal
--------------
  ----- Original Message ----- 
  From: Susan Harkins 
  To: Access Developers discussion and problem solving 
  Sent: Friday, October 03, 2003 19:31
  Subject: Re: [AccessD] force Null date/time data type value


  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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20031003/feb00e64/attachment-0001.html>


More information about the AccessD mailing list