Results 1 to 8 of 8
  1. #1
    ironfelix717 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    150

    Recordset refuses to update :)

    Do I have a good one for you lol



    This recordset won't update - when it should be.

    I don't want to explain the point of this project more than: there are 2 tables

    1.) Data_Pull1: The raw data

    2.) CleanDataTable: A table that holds the FIELDS in Data_Pull1, with other pieces of information for each field

    3.) Table_DataTypeEnum: Lists the dao data type enum and their string reference, not important for troubleshooting


    The point is that each RECORD in CleanDataTable is a FIELD in Data_Pull1. It will be iterated through to UPDATE each RECORD in Data_Pull1 for each FIELD. (round the number)

    Except thats not happening: Access won't update the record - it updates ONLY 1 field.

    And you are saying, "you forgot a .MoveNext" - Nope.

    Also to prove that it should be updating: there is a string readout that prints at the end showing each field that was set to update yet if you look at the table, it is UNCHANGED except one field.

    So, i am lost.



    To start the process:

    Open form CleanDataForm and put a value in the txtbox for rounding and hit apply.
    The value doesn't matter because the code sets the rounding to 2 anyway for demonstration.

    The msgbox will appear.
    Notice all the fields that should have updated.
    Close msgbox.
    See table - no changes to the data.




    Appreciate the help!
    regards.
    Attached Files Attached Files

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The first pass through moves rs2 to the end (EOF) so all subsequent fields get skipped here:

    Do Until rs2.EOF = True
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Have a look, I think it works now, you should always do a fully qualify the variables (i.e. As DAO.recordset).

    Cheers,
    Vlad
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Hi Paul,

    I think it gets reset in each for i loop:

    If Not rs2.EOF = True Then rs.MoveLast: rs.MoveFirst

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Quote Originally Posted by Gicu View Post
    Hi Paul,

    I think it gets reset in each for i loop:

    If Not rs2.EOF = True Then rs.MoveLast: rs.MoveFirst

    Cheers,
    It checks rs2 but moves rs.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    You're absolutely right, need more coffee and new glasses....!
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #7
    ironfelix717 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    150
    Quote Originally Posted by pbaldy View Post
    It checks rs2 but moves rs.

    AHHHH!!! I was about to check myself into a psych ward!

    Usually i catch those bone-head mistakes after a few re-compiles...


    Thanks for taking a look. And to the others who contributed.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help! Wish I could say I've never made a bone-head mistake, but it wouldn't be true.
    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. recordset won't update
    By charlieb in forum Access
    Replies: 3
    Last Post: 04-13-2015, 05:56 PM
  2. Text field refuses to change programmatically
    By kdbailey in forum Access
    Replies: 6
    Last Post: 03-08-2014, 02:32 PM
  3. Update recordset - 'Not responding'
    By tariq1 in forum Programming
    Replies: 2
    Last Post: 08-11-2012, 11:33 AM
  4. Update Query?? or RecordSet??
    By bbrazeau in forum Queries
    Replies: 2
    Last Post: 01-13-2012, 08:44 AM
  5. Update combo box from recordset
    By kc1 in forum Access
    Replies: 5
    Last Post: 12-12-2011, 06:14 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