Sub Repeat(query) query = Replace(query,"\","") xdb = Instr(UCase(query),":SELECT") if xdb>0 then Set Xonn = Server.CreateObject("ADODB.Connection") Xonn.Open Left(s,xdb-1) Set RS = Xonn.Execute(Mid(s,xdb+1)) else Set RS = Conn.Execute(query) end if Do While Not RS.EOF s = Session("TEMPLATE") Do p = Instr(s,"{") if p>0 then q = Instr(p+1,s,"}") tag = Mid(s,p+1,q-p-1) opt = "" ppp = Instr(tag,"/") if ppp>0 then opt = Mid(tag,ppp+1) tag = Left(tag,ppp-1) end if if IsNumeric(tag) then tag = CInt(tag) val = RS(tag) if val="" or IsNull(val) then val = " " if RS(tag).Name="URL" then tex = val if opt="s" then ppp = InstrRev(val,"/") if ppp>0 then tex = Mid(val,ppp+1) end if val = "" & tex & "" end if s = Left(s,p-1) & val & Mid(s,q+1) end if Loop until p=0 @ s RS.MoveNext Loop RS.Close if xdb>0 then Xonn.Close Set Xonn = Nothing end if End Sub