VB6.0中要求对象 急!!!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/06/21 21:45:14
总是提示Adodc1.RecordSource要求对象
Private Sub LblFind_Click()
If LblFind.Caption = "查询子项" Then
If TxtFather.Text = "" Then
MsgBox "请输入要查询的父项货号"
TxtFather.SetFocus
Exit Sub
End If
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & gFile & ";Mode=ReadWrite;Persist Security Info=False"
Adodc1.RecordSource = "select * from Parent,Item where Item.Item=Parent.ParentItem and Parent.ParentItem='" + Trim(TxtFatner.Text) + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
LblDelete.Enabled = False
MsgBox "该项目不是父项,重新输入"
TxtFather.SetFocus
TxtFather.SelStart = 0
TxtFather.SelLength = Len(TxtFather)
Else
Set TxtFather.DataSource = Adodc1
TxtFather.DataField = "Item"
Set LblName.DataSource = Adodc1
LblName.DataField = "Name"
Set LblColor.Data

你ADO了吗?

菜单 工程-引用-Microsoft ActiveX Data Objectsw 2.8

不是ADO的问题,因为他用的是adodc控件。看看是不是commandtype的属性没有设对。应该设成text才对的。