CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2001
    Location
    Texas,USA
    Posts
    10

    Saving an Empty Date

    how can you assign an empty text to a date type field and then save it?

    ex.

    fieldname is Bdate as date typefield
    textname is txtBdate

    code is: tablename![Bdate]=txtBdate
    error is type mismatch


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Saving an Empty Date

    In the database in the field definition must be specified that null is allowed.

    after that:
    if len(txtBdate)=0 then
    tablename![Bdate]= vbNull
    else
    tablename![Bdate]= "#" & txtBdate & "#"
    end if

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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