我写的程序中
全局变量以后public connection as new adodb.connection
我调用了它
   Private Sub Image1_Click()
Dim connection As New ADODB.connection
Dim adore As New ADODB.Recordset
Dim sql As String
Dim i%
i = MsgBox("您确定要要输入企业代码吗?", vbYesNo)
If i = 6 Then
   Set connection = New ADODB.connection
   Set adore = New ADODB.Recordset
   With adore
      .ActiveConnection = connection
      .CursorLocation = adUseClient
      .CursorType = adOpenDynamic
      .LockType = adLockOptimistic
      .Source = "select * from 企业代码"
      .Open
      .AddNew
    End With
    adore.Fields(0) = Trim(Text1.Text)
    adore.Update
    adore.ActiveConnection = Nothing
    adore.Close
    Set adore = Nothing
End If
End Sub
调试的时候,显示  .ActiveConnection = connection没有连接上,这是什么问题 ?
在线等