SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Nov 2006
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Incrementing field by 1 automatically in Access db

    Hi all, I am using testpartner to automate a test and send data back to an access db. The main function is working fine but I want to have an individual ID for each time i run the test. Preferably i want this to be done automatically each time i run the test.
    I am not entirely sure how to do this, the current code i have is:

    rs.AddNew

    rs.Fields("ID") = (rs.Fields("ID") + 1)

    rs.Update

    This doesnt work and i am no coder! any help would be greatly appreciated, cheers.
    ps. I am using TP 5.6

  2. #2
    Junior Member
    Join Date
    Nov 2006
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Incrementing field by 1 automatically in Access db

    Just incase anyone needs this for future reference:
    After some fiddling about i managed to get it to work, i simply moved to the final record and then used a do.. while loop to update all the current records to be + 1.

    This seems to work now, the code is as follows:

    rs.MoveLast

    Do While rs.BOF = False


    rs.Fields("ID") = rs.Fields("ID").Value + 1

    rs.MovePrevious

    Loop


    rs.AddNew

    rs.Fields("ID") = "1"

    rs.Fields("Parameters") = "This test was run with " & ParameterText & " Garbage Collections"

    rs.Update

    cheers

 

 

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 Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 12.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:56 PM.

Copyright BetaSoft Inc.