Office中国论坛/Access中国论坛

标题: 关于这个代码错在哪里啊?高手帮忙看看~ [打印本页]

作者: kty    时间: 2005-2-24 20:16
标题: 关于这个代码错在哪里啊?高手帮忙看看~
Private Sub List169_Click()

  If IsNull(List169) Then Exit Sub

  Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("select * from 表1 where 表1.ID编号='" & List169 & "';", , dbPessimistic)

  If IsNull(rs!项目) Or Trim(rs!项目) <> "" Then Text187 = rs!项目

  If IsNull(rs!解释) Or Trim(rs!解释) <> "" Then Combo189 = rs!解释

  rs.Close

  Set rs = Nothing

End Sub

PSist169为列表框,表1的ID编号字段是自动编号.

运行的时候错误提示:标准表达式中数据类型不匹配
作者: hi-wzj    时间: 2005-2-24 20:33
Set rs = CurrentDb.OpenRecordset("select * from 表1 where 表1.ID编号=" & List169 & ";", , dbPessimistic)






欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3