Set cn = New Connection
cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=xxxx; Data Source=xxxx_nt"

Set rs2 = New Recordset
  rs2.CursorLocation = adUseClient 
  rs2.Open "SELECT * FROM table1", cn, adOpenDynamic, adLockOptimistic, adCmdText

Set rs3 = New Recordset
  rs3.CursorLocation = adUseClient 
  rs3.Open "SELECT * FROM table2", cn, adOpenDynamic, adLockOptimistic, adCmdText

rs2.MoveFirst
    rs2.Find (num)         
    
    If Not rs2.EOF Then    
      DisplayRecord       

Else    

rs3.MoveFirst
    rs3.Find (num)         '----------------------------Run time error ------------------------------
    
    If Not rs3.EOF Then    

vbqa 發表在 痞客邦 留言(2) 人氣()