-1

what method should I be using when I want to search/lookup a recordset value in another recordset? For example I want it to run a set of results for this year, I then want to for each record search another recordset (previous year) and see if they exist. If they do I then want to pull that data out. E.g. In one recordset there is a ist of Premier league teams and their finishing positions for 2012. In another recordset we have the same but with 2013 positions. I want to be able to loop through the 1st recordset and for each record in recordset 1 lookup the 2012 position in recordset 2 and print these using Debug.Print. I hope I'm clear. What is the best method for going about this? Using arrays or recordsets? Or another method?

recordset1 Team 2013_position Manchester United 1 Manchester City 2

recordset2 Team 2012_Position Manchester United 2 Manchester City 1

4

1 回答 1

0

我使用带有 1 个参数(团队名称)的查询 ala: qry = "select score from table2 where teamname = ?"

rs1 = recordset1
do until .eof
  qry1.parameter(0).value = rs1.team
  set rs2 = qry1.execute
  debug pring rs2.fields("Score")
  rs2.close
  rs1.movenext
end do
rs1.close
于 2013-07-23T14:28:59.147 回答