新建一个公共模块
public conn as new adodb.connection
public res as new addob.recordset
public sub Init()
if conn.state=adstateopen then
conn.close
end if
conn.open "your connecting string"
if res.state=adstateopen then
res.close
end if
res.open "Your Sql Language",conn,3,1
end sub
然后再子窗体中直接调用Init()过程就可以了~~~~~~

解决方案 »

  1.   

    我的连接从来都是放在模块中的,没问题的public conn as new adodb.connection
    public res as new addob.recordset
    sub main()
    conn.open "your connecting string"
    res.open "Your Sql Language",conn,3,1
    end sub然后在工程属性中将 startup object设为SUB MAIN
    就行了
      

  2.   

    我知道了。设置conn的连接属性打开什么的必须在过程中。就是必须在sub中
    好,结帖。