Results 1 to 2 of 2
  1. #1
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200

    INSERT INTO with date fields

    Hello,



    I have an insert into statement this involves inserting values into date/time fields. I understand the a '#' has to come before and after the value, and when all values are populated this works great.

    Code:
    INSERT INTO TableName VALUES (#1/1/2013#,#1/2/2013#)
    However, what about in the case of Nulls? The resulting statement then looks like the following. This results in the statement trying to put a '##' in the table and it doesn't like it.

    Code:
    INSERT INTO TableName VALUES (#1/1/2013#,##)
    I am trying to input records into a local Access table, not a SQL table.

    Thanks!

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Use null instead of ##.
    Code:
    INSERT INTO TableName VALUES (#1/1/2013#,Null)

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

Similar Threads

  1. checkbox to insert date
    By efk0107 in forum Forms
    Replies: 6
    Last Post: 01-17-2015, 11:41 AM
  2. Replies: 5
    Last Post: 08-01-2013, 02:21 PM
  3. Replies: 2
    Last Post: 10-20-2012, 12:38 PM
  4. Insert date function
    By geraldk in forum Forms
    Replies: 2
    Last Post: 01-01-2012, 06:37 PM
  5. SQL INSERT INTO Date Syntax Error
    By tuna in forum Programming
    Replies: 5
    Last Post: 08-10-2010, 06:17 AM

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