Hello again,<BR><BR>I will try to explain this problem a bit better.<BR>I have a set of session variables (pulled from a previous form) which I need to check against a table hence the SQL. The session variables are called<BR><BR>appcode0<BR>appcode1<BR>appcode2<BR> ect.<BR><BR>There will only be 1 set of results for each query so I should be able to take out the do loop I think?<BR><BR>All I need to do is check the database against each appcode and pull the relevant details for that record into more variables to be displayed at a later date!<BR><BR>The database is too big for me to do the loop in my code so how do I pull all the data in 1 go and store it with the correct appcode?<BR><BR>my code looks like this<BR><BR>&#060;%<BR>Set objCon = Server.CreateObject ("ADODB.Connection")<BR> Set objRec = Server.CreateObject ("ADODB.Recordset")<BR> objCon.Open "dsn=kp;uid=;pwd=;"<BR><BR>for i = 0 to (session("multiplier")-1)<BR><BR>sql = "select applicationno,applicationname,applicationkey from publications where customercode = &#039" & session("appcode" & i) & "&#039"<BR>set objRec = objcon.execute( SQL )<BR><BR> objrec.movefirst<BR> do while not objrec.eof<BR> &#039move data into vars<BR> session("kpno" & i) = objrec("applicationno")<BR> session("coursedesc" & i ) = objrec("applicationname")<BR> session("appkey" & i) = objrec("applicationkey")<BR> objrec.movenext<BR> loop<BR><BR> objrec.close<BR><BR>next<BR><BR>&#039cleanup<BR>se t objrec=nothing<BR>objcon.close<BR>set objcon=nothing<BR>%&#062;<BR><BR>Hope this explains things a bit better this time.<BR><BR>Thanks for all your help<BR>Stan