Increment Field Value

Results 1 to 2 of 2

Thread: Increment Field Value

  1. #1
    Join Date
    Dec 1969
    Posts
    730

    Default Increment Field Value

    Anybody have a thought on how to increment the data in a DB field...<BR>ex.<BR>Registrants Database has fields A through C. Web form allows users to put in numeric values that posts to update.asp.<BR>Update.asp then should increment the value in fields A through C based upon user input. <BR>Therefore, if field A contained a value of 1, and the user put in 2, field A should now read 3.<BR>I am using an UPDATE query and the dang thing overwrites the existing data, so the field in this example would read 2 rather than 3. <BR>Thanks for any ideas.<BR>&#060;% Set thisproject = Server.CreateObject("Frustration") %&#062;<BR>Andy

  2. #2
    Join Date
    Dec 1969
    Posts
    730

    Default RE: Increment Field Value

    Figured it out. I just added the variable to the existing data in the field (the field is defaulted to 0) <BR>here is the working SQL<BR><BR>strSQL = "UPDATE sems " & _<BR>"SET sems.distatt = " & distatt & " + sems.distatt, " & _<BR>"sems.rsmatt = " & rsmatt & " + sems.rsmatt, " & _<BR>"sems.otheratt = " & otheratt & " + sems.otheratt " & _<BR>"WHERE (((sems.semid)=" & semid & "))"<BR><BR>Thanks anyway<BR>Andy<BR>

Posting Permissions

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