Results 1 to 3 of 3
  1. #1
    tariq1 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    16

    Update recordset - 'Not responding'


    Hi, I am trying to run the following code which updates a recordset, but Access just crashes with 'Not responding'
    Any guidance is much appreciated, thank you
    Code:
    Sub updatechildren()
    
    Dim dbsSchool As DAO.Database
    Dim rstChidren As DAO.Recordset
    Dim strSQL As String
    Set dbsSchool = CurrentDb
    strSQL = "select * from Children where Gender = 2 "
    Set rstchildren = dbsSchool.OpenRecordset(strSQL, dbOpenDynaset)
    If rstchildren.EOF Then Exit Sub
    rstchildren.Edit
    rstchildren![Hobbies] = "Football"
    Do Until rstchildren.EOF
    Loop
    
    End Sub

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    What exactly do you think this is doing? What are you trying to do?

    You might research the Recordset.MoveNext

    see http://allenbrowne.com/ser-29.html

    Research MS access stepping though code

    Generally,
    Put a breakpoint in the subroutine/procedure you want to step into and then
    perform the act that executes that code.
    Then you can step through the code - line by line - by using F8

  3. #3
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Your code is going into an infinite loop here:


    Do Until rstchildren.EOF
    Loop

    Not only does it not do anything, it never exits because it is missing rstchildren.movenext

    If I read your code right, it could be replaced by 1 line:

    currentdb.execute "Update [children] set [hobbies] = 'Football' where [Gender] = 2", dbfailonerror

    John
    Last edited by John_G; 08-11-2012 at 11:34 AM. Reason: fix line breaks

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

Similar Threads

  1. Update Query?? or RecordSet??
    By bbrazeau in forum Queries
    Replies: 2
    Last Post: 01-13-2012, 08:44 AM
  2. Replies: 3
    Last Post: 12-13-2011, 06:09 PM
  3. Update combo box from recordset
    By kc1 in forum Access
    Replies: 5
    Last Post: 12-12-2011, 06:14 PM
  4. Replies: 3
    Last Post: 08-03-2010, 02:24 PM
  5. Replies: 1
    Last Post: 07-17-2010, 08:55 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