不小心还没写完就发出来了!继续进程外部件,Class1对象
Private rs1 AS ReocrdsetPublic Property Set R(Obj)
    Set rs1 =Obj
End Property主应用程序:
Private rs2 AS Recordset
Private objNew AS Class1Public Sub x()
    Set objNew = New Class1
    Set rs2 = New Recordset    Set objNew.R = rs2
End Sub执行到Set rs1=obj时,出现错误“440”,类型不匹配
我错在哪里,recordset不能作为参数传递给部件吗?
我看书上说recordset做参数还是个好主意

解决方案 »

  1.   

    再把例子改简单点:
    进程外部件,Class1对象
    Public rs1 AS Reocrdset主应用程序:
    Private rs2 AS Recordset
    Private objNew AS Class1Public Sub Form_Load()
        Set objNew = New Class1
        Set rs2 = New Recordset    Set objNew.rs1 = rs2
    End Sub
      

  2.   

    你传递一个Recordset试试。
    Public Property Set R(Recordset)
        Set rs1 =Obj
    End Property
      

  3.   

    我最初试过
    Public Property Set R(Obj AS Recordset)
        Set rs1 =Obj
    End Property这样死得更快,在执行Set objNew.R = rs2 时,VB就已经发现变量不匹配,只不过因此是整个R方法都失败、不可用,这次错误代码才是“440”——“方法无效”救救我,我可以加分。急!急!急!