VBA 运行时显示错误424要求对象 5
PublicadoconAsNewADODB.ConnectionPublicadoRsAsNewADODB.RecordsetPublicSubMain()adocon...
Public adocon As New ADODB.Connection
Public adoRs As New ADODB.Recordset
Public Sub Main()
adocon.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_yygl.mdb;Persist Security Info= False"
End Sub
Public Function ESQL(ByVal sql As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.Open StrCnn
Set rs = New ADODB.Recordset
rs.Open Trim(sql), cnn, adOpenKeyset, adLockOptimistic
Set ESQL = rs
End Function
Public Function StrCnn()
StrCnn = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_yygl.mdb;Persist Security Info= False"
End Function 展开
Public adoRs As New ADODB.Recordset
Public Sub Main()
adocon.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_yygl.mdb;Persist Security Info= False"
End Sub
Public Function ESQL(ByVal sql As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.Open StrCnn
Set rs = New ADODB.Recordset
rs.Open Trim(sql), cnn, adOpenKeyset, adLockOptimistic
Set ESQL = rs
End Function
Public Function StrCnn()
StrCnn = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_yygl.mdb;Persist Security Info= False"
End Function 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询