Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369

    Question Unanswered: Simple question about datatypes/update mismatch

    what is a proper way to empty a cell using UPDATE?

    In my date field (short date format) I get a mismatch error message when trying to empty the value like this from a optionControl on a form:

    Dim strClientID As String
    strClientID = Me.ID_cc
    DoCmd.RunSQL "(UPDATE tbl_cc
    SET tbl_cc.information = "" where tbl_cc.ID_CC = strClientID)"

    - produces an arror message saying that there is something wrong in the where part of the expression...

    The following manual query works:
    UPDATE tbl_cc SET tbl_cc.information = "" WHERE (((tbl_cc.ID_cc)=401903));

    What am I doing wrong?

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Insted the empty String "" use NULL

    Example
    UPDATE urTable SET urTable.[dateField] = Null WHERE (((urTable.dateField)=#3/17/2003#));

  3. #3
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369
    Did not help, I think there is something other wrong.
    I tried to move the code as it is from the GotFocus event of the optRadiobutton, go the OnMouseDown event, and now I get a parametre quetion (strClientID), nothing aboiut the where clause. In case there is something strange in memory or the like, I perform a restart , have been working since Sunday morning without restarting the PC. Access have been frequently closed and reopened though.

Posting Permissions

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