Dim ADOcn As New Connection
Public Sub main()
Dim strAccess As String
strAccess = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mydata.mdb;Persist Security Info=False"
If ADOcn Is Nothing Then
ADOcn.Open strAccess
End If
frmmain.Show
End Sub
上面的能编译通过
我把sub main设为启动项
然后在一个表单中
Private Sub Form_Load()
Dim strSQL, str1 As String
Dim ADOrs As New Recordset
ADOrs.ActiveConnection = ADOcn '当我把记录集adors与数据库adocn绑定时就出错了
strSQL = "select * from phone"
ADOrs.Open strSQL
str1 = "联系人" + vbTab + "QQ" + vbTab + "手机" + vbTab + "座机" + vbTab + "出生日期"
With MSFlexGrid1
.Clear
.Rows = 0
.Cols = 5
.AddItem str1
Do While Not ADOrs.EOF
str1 = ADOrs.Fields("联系人") + vbTab + ADOrs.Fields("QQ") + vbTab + ADOrs.Fields("手机") + vbTab + ADOrs.Fields("座机") + vbTab + ADOrs.Fields("出生日期")
.AddItem str1
ADOrs.MoveNext
Loop
End With
End Sub
怎么办呢
[求助]实时错误3001