I think this is the problem:
Code:
if(Request.Form("locations") <> "") then cominsert__varlocation = Request.Form("locations")
You assign the value of Request.Form("locations") to cominsert__varlocation. However, the locations is now a form item that can have multiple items. So, you should no longer store it in cominsert__varlocation, but use location in your query instead:
Code:
cominsert.CommandText = "INSERT INTO tblsamples (Freezer, Tower, Box, Location, UPN, UPNA, Date_Drawn, Date_Stored, Person_Storing,
Total_Vials, Freezing_Method, Comments) VALUES ('" + Replace
(cominsert__varfreezer, "'", "''") + "', '" + Replace
(cominsert__vartower, "'", "''") + "', '" + Replace
(cominsert__varbox, "'", "''") + "', '" + Replace
(location, "'", "''") + "', '" + Replace
(cominsert__varupn, "'", "''") + "', '" + Replace
(cominsert__varupna, "'", "''") + "', '" + Replace
(cominsert__vardate_drawn, "'", "''") + "', '" + Replace
(cominsert__vardate_stored, "'", "''") + "', '" + Replace
(cominsert__varperson_storing, "'", "''") + "', '" + Replace
(cominsert__vartotal_vials, "'", "''") + "', '" + Replace
(cominsert__varfreezing_method, "'", "''") + "', '" + Replace
(cominsert__varcomments, "'", "''") + "') "
Does that make sense? instead of the comma separated form value (e.g. 001, 002, 003) you know use each location in the loop (e.g. 001, then 002, and in he next iteration 003 and so on).
If you look at the output you posted, you can see that it's executing 6 identical queries. By making the above changes, I think that should be fixed.
Can you please start a new thread if you have more questions? We ruined this one a bit with all those way too long queries.... I can hardly read it anymore....
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.