+ Reply to Thread
Results 1 to 6 of 6

Recordset Looping

  1. #1
    Forum Contributor
    Join Date
    04-16-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    216

    Recordset Looping

    I'm trying to loop through a table records and fields. The field loops work fine, but I can't get it to move down to the next "tbl" record..


    i'm using 3 record sets all based on the same table
    tbl = the set I want to loop through
    rst1 = loops through table field names and compares against rst2
    rst2 = loops through table field names



    Please Login or Register  to view this content.

    I was thinking that maybe an SQL statement would work with to copy and paste if ID_Vessel = OldVesID AND Est_ID - OldEst... but i'm not sure how i could replace only the copied ID_Vessel & Est_ID with NewVesID & NewEst. or maybe some other nice and easy way.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Recordset Looping

    Why are you closing rst1 before you move to the next record?
    Rory

  3. #3
    Forum Contributor
    Join Date
    04-16-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    216

    Re: Recordset Looping

    rst1 is used to check field names against rst2 field names...

    if the field names match, then it put the value from rst2 into rst1. Not sure where I would put move to next record, that's why 'tbl' is used, to see if ID_Vessel and Est_ID match my criteria... then it runs rst1 & rst2



    This code works for going across field names because of the "for each"

    Please Login or Register  to view this content.
    Last edited by Cobra17; 10-06-2021 at 12:21 PM.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Recordset Looping

    I think you missed my point. Your code processes the first record in tbl but then closes rst1 before moving onto the next record in tbl. That makes no sense.

  5. #5
    Forum Contributor
    Join Date
    04-16-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    216

    Re: Recordset Looping

    where should it go?

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Recordset Looping

    After you finish with tbl I would assume.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Help with looping/dumping recordset
    By jsabo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-17-2015, 05:29 PM
  2. Open another recordset within current recordset vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2015, 04:32 AM
  3. Update recordset using vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2015, 10:27 AM
  4. Excel 2007 : Recordset problem
    By pet in forum Excel General
    Replies: 1
    Last Post: 12-06-2010, 03:31 PM
  5. [SOLVED] Need ADO Recordset Help
    By Mr B in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-21-2006, 11:55 AM
  6. Using DSUM on a Recordset
    By Chaplain Doug in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2006, 07:50 PM
  7. [SOLVED] Recordset's RowID as part of Recordset
    By Trip in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2005, 06:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1