======来者有分,代码错误,请帮忙看看!谢谢=======
代码如下:
1 Adodc2.ConnectionString = strconn
2 Adodc2.CommandType = adCmdText
3 Adodc2.RecordSource = "select * from Deptartment order by DeptNum"
4 Set FindtxtName.DataSource = Adodc2
5 FindtxtName.DataField = "DeptName"
6 Adodc2.Recordset.MoveFirst
7 While Not Adodc2.Recordset.EOF
8 CmbDeptName.AddItem (Adodc2.Recordset("DeptName"))
9 Adodc2.Recordset.MoveNext
10 Wend
如果有5、6两行,程序没有问题。但是如果去掉程序就报错,
错误原因:实时错误“91”对象变量或WITH块变量未设置。
请问:我该如何做呢?