Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    11

    Unanswered: updating the date to null value

    i'm using ms access to my program and i have this situation that i have to set a deadline so i have a textbox (txtDate) and a checkbox that once the checkbox value is 1 (one) the textbox (txtDate) for setting date will be enabled then when the value is 0 (zero) the textbox (txtDate) will be disabled... the textbox (txtDate) has a format of short date for entry of the user and then save it to the database... but after saving, their is an instance that it can be edited so i should update the changes made but once i click the update button and the value of the textbox (txtDate) is set to be empty... there is an error saying "type mismatch"... i know that it is not applicable for the date format to be null.... can u pls. help me solve this kind of problem.... i think i only need to convert the date but i don't know how to do it.... so i really need help. thanks in advance!!!!!

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    txtDate = ""

    ???

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Apr 2004
    Posts
    11
    thanks for the reply!!!! but i've alrady used txtDate = "" and it doesn't work, error occurs saying "type mismatch".... i think date format can't be null... do you have a way in solving this.

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    "" is nothing to do with Null - it's an empty string.

    if txtDate is a textbox on a form and the textbox is bound to a table field of type date, it should work fine.

    also: i prefer TRUE/FALSE over 0/1 for a checkbox: i realise that A's FALSE is 0 and TRUE is anything that is not FALSE, but A's "native" TRUE = -1


    izy
    currently using SS 2008R2

  5. #5
    Join Date
    May 2004
    Location
    Moscow, Russia
    Posts
    29
    me.ControlDate = NULL

    or

    change value of dataset (no form control):

    ADP
    Dim rs As New ADODB.Recordset
    Set rs = Me.RecordsetClone
    rs.Bookmark = Me.Bookmark
    rs.Fields("fieldname") = null
    rs.Update
    rs.Close
    Set rs = Nothing


    mdb
    Me.Dynaset.Bookmark = Me.Bookmark
    Me.Dynaset.edit
    Me.Dynaset.Fields("fieldname") = null
    Me.Dynaset.Update

    samples for Access XP
    Last edited by alexeyK; 05-21-04 at 09:46.

Posting Permissions

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