Results 1 to 4 of 4
  1. #1
    Darkmatter5 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    11

    Fields are being set to null, but not how I'm intending

    Here's the query I'm running.

    UPDATE Customers SET BatterySize = NULL
    WHERE BatterySize <> '10'
    OR BatterySize <> '13'
    OR BatterySize <> '312'
    OR BatterySize <> '675';




    My intent is if a record has anything in it's field "BatterySize", other than 10, 13, 312 or 675, I need to set it to NULL. The end result data is essentially numerical, but due to the data I need to import, this field may or may not have text, that's why I have to set with single quotes and not just the value.

    Thanks for your help!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Have you tried creating a select query and using the AND operator vs the OR operator?

    If there are not many records and this process is not going to be repeated, I suppose you could run four action queries.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    BatterySize is a text type field?

    Maybe:

    UPDATE Customers SET BatterySize=Null WHERE BatterySize NOT IN ('10', '13', '312', '675')
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I always forget the NOT IN

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 10-24-2012, 02:59 PM
  2. Sum fields in subform if not Null
    By atom in forum Forms
    Replies: 6
    Last Post: 02-10-2012, 04:03 PM
  3. Is Not Null...Multiple fields
    By msk7777 in forum Access
    Replies: 13
    Last Post: 11-17-2011, 02:52 PM
  4. Combine two fields, Null fields involved
    By yes sir in forum Access
    Replies: 9
    Last Post: 10-03-2010, 09:20 AM
  5. Replies: 5
    Last Post: 03-20-2010, 08:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums