(急)VB 运行时,出现From子句语法错误,怎么解决?
PrivateSubcmbName_Change()Dimconditioncondition=Trim(cmbField.Text)IfAdodc1.Recordset...
Private Sub cmbName_Change()
Dim condition
condition = Trim(cmbField.Text)
If Adodc1.Recordset.Fields(condition).Type = 202 Then
'被选择的字段类型如果是文本类型
Adodc1.RecordSource = "select * from 目录表 where" & condition & "='" & cmbName.Text & "'"
'被选择的字段类型如果是数值类型
Else
Adodc1.RecordSource = "select * form 目录表 where" & condition & "=" & cmbName.Text
End If
Adodc1.Refresh
Text1.Text = Adodc1.Recordset.Fields("档案编号") '将字段值在文本框中显示
Text2.Text = Adodc1.Recordset.Fields("档案名称")
Text3.Text = Adodc1.Recordset.Fields("保存年限")
Text4.Text = Adodc1.Recordset.Fields("起始年度")
Text5.Text = Adodc1.Recordset.Fields("数量")
End Sub
各位大哥帮帮忙,十分感谢! 展开
Dim condition
condition = Trim(cmbField.Text)
If Adodc1.Recordset.Fields(condition).Type = 202 Then
'被选择的字段类型如果是文本类型
Adodc1.RecordSource = "select * from 目录表 where" & condition & "='" & cmbName.Text & "'"
'被选择的字段类型如果是数值类型
Else
Adodc1.RecordSource = "select * form 目录表 where" & condition & "=" & cmbName.Text
End If
Adodc1.Refresh
Text1.Text = Adodc1.Recordset.Fields("档案编号") '将字段值在文本框中显示
Text2.Text = Adodc1.Recordset.Fields("档案名称")
Text3.Text = Adodc1.Recordset.Fields("保存年限")
Text4.Text = Adodc1.Recordset.Fields("起始年度")
Text5.Text = Adodc1.Recordset.Fields("数量")
End Sub
各位大哥帮帮忙,十分感谢! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询