1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32:
<%totalrecords = request.form("totalrecords") ' use i as a counter For i=1 to totalrecords recordname = "Getcats" + Cstr(i) workcodename = "workcode" + Cstr(i) if i = totalrecords then updatequery = updatequery + "Update Nu_KPI_Catagories Set Paul = '"+request.form(recordname)+"' Where WW_Code = '"+request.form(workcodename)+"' and SiteID ='PE'" else updatequery = updatequery + "Update Nu_KPI_Catagories Set Paul = '"+request.form(recordname)+"' Where WW_Code = '"+request.form(workcodename)+"' and SiteID ='PE' <br> go <br>" end if next 'repeat the code and move on to the next value of i 'once the query is built execute it if totalrecords <> "" then Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_Nu_KPI_STRING MM_editCmd.CommandText = updatequery response.write(MM_editCmd.commandtext) MM_editCmd.Execute MM_editCmd.ActiveConnection.Close end if %>