Results 1 to 5 of 5
  1. #1
    Middlemarch is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2015
    Posts
    479

    Writing same thing to a range of columns - best method?

    I'd like to clear columns 10-22 in my table. Either null or "".
    Would you just loop through writing to each field individually - or is there a better way, ? ?



    Thanks.

  2. #2
    Middlemarch is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2015
    Posts
    479
    From Google I found

    UPDATE table
    SET Newvalue
    WHERE criteria

    If table is table1, newvalue is "", criteria is id = 22 and Fieldnames Like *Wk*

    Is that do-able in an update query?
    Thanks.

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    Update query will work. If you are updating the entire table (all records) you won't need criteria.

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    That is not the correct syntax for an Update query. It should be:

    UPDATE table
    SET Field1 = Newvalue1. Field2 = newvalue2, ...
    WHERE criteria

    The criteria specifies which records to update, not which fields to update. In your case, you don't need criteria.

    It will be much easier if you use the query design grid, rather than writing the SQL manually.

  5. #5
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    I used this on my excel code:

    wkSheetC.Columns.Range("A:C,E:G,I:M").Delete

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

Similar Threads

  1. Replies: 7
    Last Post: 07-28-2016, 03:12 PM
  2. Replies: 6
    Last Post: 06-25-2016, 02:56 PM
  3. Is an Event the same thing as a Method?
    By Access_Novice in forum Access
    Replies: 3
    Last Post: 01-07-2015, 06:16 PM
  4. Another thing i'm stuck on
    By Durks123 in forum Database Design
    Replies: 1
    Last Post: 07-29-2013, 06:07 PM
  5. Replies: 1
    Last Post: 07-13-2012, 07:58 PM

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