Results 1 to 3 of 3

Thread: For each rs?

  1. #1
    Join Date
    Oct 2003
    Posts
    311

    Unanswered: For each rs?

    I have no experiance with recordsets in access.

    What i would like to do is select * from a table.
    1 column will be blank
    then i would like to add an auto incrementing value to that field
    something like


    Dim iNum as integer
    iNum = 0

    Do while not RS.eof
    iNum = iNum +1
    rs.field(1) = iNum
    rs.MoveNext
    Loop


    can anyone help????

  2. #2
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: For each rs?

    Originally posted by mikezcg
    I have no experiance with recordsets in access.

    What i would like to do is select * from a table.
    1 column will be blank
    then i would like to add an auto incrementing value to that field
    something like


    Dim iNum as integer
    iNum = 0

    Do while not RS.eof
    iNum = iNum +1
    rs.field(1) = iNum
    rs.MoveNext
    Loop


    can anyone help????
    Assuming you don't need too much help since you're close, try adding rs.Edit before you assign a value and finish off with rs.Update. Also, if your trying to add to the first column, I think it is 0 based so make it rs.Fields(0) = iNum + 1.

    Gregg

  3. #3
    Join Date
    Oct 2003
    Location
    Seattle, WA
    Posts
    4

    Field where recordset starts

    Hi,
    I'm new to this, but this question I struggled with. Three points
    1) Be sure and declare your recordset and queries at the start.
    2) I find it prudent to delete my temporay queries. If not these often are saved and will often prevent code from executing on next startup
    3) The first field is (0). The order of a particular recordset however is determined by the order the recordset was built in the query. If you are working directly in a table, then the order is the table order.
    Hope this helps
    MJRedlin

Posting Permissions

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