Results 1 to 5 of 5
  1. #1
    rawandjamal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2010
    Posts
    5

    update query

    i have an access database and it contain table and this table has a large number of record now i have a problem
    that is a problem :


    in field1 when you see i has a blank cell now i want update this blank cell whith a previous record
    i mean i want to update the blank cell whith w,sam and stop it in A,smith and coninues to A,smith and stop in p,edward ....etc
    are any code that let me do this whithout manualy because the record is very large
    please help

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    To my knowledge, it can't be done with an update query. You can do it in VBA with a recordset loop of the records, making sure they're in order. Set a variable to the first value, then inside the loop test the variable against the current record. If the record field is empty, set it to the variable's value, else change the variable to the field's value (not being empty would indicate a new value). You'll want a recordset and a Do...Loop; more info on both in VBA help if you're not familiar.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rawandjamal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2010
    Posts
    5
    thanks mr.paul i think its a solution if i use a vba but can u tell me any website or any thing that tell me how do it with vba code i that is very kind of you if you told me

  4. #4
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    You could use an update query....just use the record id for the range of records for your update...then manually put the name you want to update the blank's to. It would work if this is a 'one-time' clean-up. Otherwise you will definitely want some vba code.

  5. #5
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Here's an example of a recordset loop:

    http://www.granite.ab.ca/access/email/recordsetloop.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Select Query > Update Query > Table Field
    By tuggleport in forum Queries
    Replies: 2
    Last Post: 08-09-2012, 07:04 AM
  2. Replies: 2
    Last Post: 01-31-2011, 08:31 AM
  3. update query
    By ManvinderKaur in forum Access
    Replies: 3
    Last Post: 08-13-2010, 06:09 AM
  4. Update Query with parameter query
    By mimikate in forum Queries
    Replies: 2
    Last Post: 03-16-2010, 09:10 PM
  5. Update Query- selective update?
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-29-2009, 11:15 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