Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Wisconsin, USA
    Posts
    160
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Batch update (10.4)

    Am trying to perform a batch update (reset records to '' or Null) on my database. Have figured out how to do that with alpha/numeric fields but am having trouble with boolean. What I have so far is:

    cn.Execute "Update mytablename" & _
    " Set myfldname = Null" 'or
    " Set myfldName = ''"

    This does not work for a boolean field. Nor does "Set myfldName = False".

    There are two tables and just found out that one works, the other does not. Here is the code for both tables:

    cData.Execute "UPDATE Attending" & _
    " Set numAttend = Null,MealAmount = Null, SouvenirNum = Null," & _
    " SouvenirAmount = Null, GiftAmount = Null," & _
    " Deceased = NULL, MailLabel = NULL, Souvenir = NULL"

    cData.Execute "UPDATE Members" & _
    " SET EventName = '', EventNum = Null, EventAmount = Null," & _
    " EventAttend = False"

    The update members set eventattend to false or Null clears the check mark in Access. The update attending does not.

    Any help is appreciated.
    Thanks

    Kim

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Batch update (10.4)

    I don't see anythong wrong with the syntax in itself. You should use False; you can't set a boolean field to a string, not even an empty one. Although it shouldn't make any difference, you could try explicitly stating the source of the field:

    cn.Execute "UPDATE myTableName SET myTableName.myFldName = False"

    If the table you're trying to update is a linked table, is it updateable, and does it support boolean fields? One other thing you could try is to set the field to 0, this is equivalent to False in most systems.

  3. #3
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    Wisconsin, USA
    Posts
    160
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Batch update (10.4)

    Thanks for the response. Messing around with this problem, I noticed that the code was not complete. And this before the first homebrew, which I'm off to now. Appreciate the help
    Thanks

    Kim

Posting Permissions

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