CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2001
    Posts
    2

    null date when entering into database through ado

    I have a samall problem .When i enter a date value through a recordset object the sql statement does not execute.

    i am getting this value from a textfield which is blank.
    the idea is to enter date of birth which the user of the form may not know.so to allow null entries.
    please help.
    thanx



  2. #2
    Join Date
    May 2001
    Location
    Australia
    Posts
    133

    Re: null date when entering into database through ado

    Make sure that DateField allows Null value. Then,


    If (IsDate(MyForm.txtDate) = true) then
    m_rs("DateField") = CDate(MyForm.txtDate)
    else
    m_rs("DateField") = null
    End If
    m_rs.Update





    --Take the life as it comes--

  3. #3
    Join Date
    Oct 2001
    Location
    VT, USA
    Posts
    3

    Re: null date when entering into database through ado

    Hi. Try the Nz function. It handles zero values.


  4. #4
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: null date when entering into database through ado

    Note about that, Nz is only available in VBA, not in real VB.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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

Featured