Results 1 to 4 of 4

Thread: How can insert a null adate using execute statement

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    55
    I am using Access Database in my VB application.
    Thare is one table which contains HireDate field which is of Date data type.This Field is optional.How can i insert a null date into it using SQL Insert Statement From VB. I am using DAO and Execute method.


  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    You could either pass the Null keyword, or you could specify the fields you want to fill.

    eg
    with a table like this:
    name:
    tblContact

    Fields:
    ContId (Long)
    ContName (Text)
    ContBirthday (Date)

    Insert into tblContact Values( 1, 'Frans', Null)

    Or

    Insert Into tblContact (ContId, ContName) Values( 1, 'Frans')

  3. #3
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    455
    Hello gorthims,

    In my database programs, this allways works!

    Private Sub Form_Load()
    Dim DbSetting As String
    Dim DB As Database
    Dim RS As Recordset

    DbSetting = "f:\q.mdb"
    Set DB = OpenDatabase(DbSetting)
    Set RS = DB.OpenRecordset("select * from personal")
    RS.MoveFirst

    'HireDate is type Date
    RS.Edit
    RS("HireDate") = Null
    RS.Update

    End Sub


    Nice regards,

    Michelle.

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    55

    Smile

    ThanQ Frans C

Posting Permissions

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



Click Here to Expand Forum to Full Width