findfirst没能同时查找两个字段. 用SQL查询语句来查询比较方便. dim strsql as string strsql ="select * form 表名 where 字段1= 'xxx' and 字段2= 'xxx'" Set rst = dbs.OpenRecordset(strsql) 这样rst中所有的记录都是符合你要求的记录.
语法错误(操作符丢失)在查询表达式‘* form 题库 where 难度=2 and 类型='单选''中开始我直接在属性里设置数据源和字段时就可以同时查找两个以上的字段,现在加密码了,用代码连接后就不行了TO:风之兄,上次拖你的福,这回再帮帮我吧?
你的难度字段是什么类型,如果是字符型就加上单引号. form 写错了,应该是from
to 风雨无阻 你的sql语句怎么没有select 阿,当然提示操作符丢失了 不要犯低级错误阿
这回倒是不出错误信息了,可是明明label标签连接上了数据库,但运行这段后却不转到相应的记录,什么提示也没有,真愁死了:( 整个代码是这样的: Dim dbs As Database Dim rst As Recordset Dim strsql As String strsql = "select * from 题库 where '难度'=2 and '类型'='单选'" Set rst = dbs.OpenRecordset(strsql)
单引号加的不对. strsql = "select * from 题库 where 难度='2' and 类型='单选'" 想让label显示还应该加上 set data1.recordset=rstlabel.datafield=xxx
用SQL查询语句来查询比较方便.
dim strsql as string
strsql ="select * form 表名 where 字段1= 'xxx' and 字段2= 'xxx'"
Set rst = dbs.OpenRecordset(strsql)
这样rst中所有的记录都是符合你要求的记录.
form 写错了,应该是from
你的sql语句怎么没有select 阿,当然提示操作符丢失了
不要犯低级错误阿
整个代码是这样的:
Dim dbs As Database
Dim rst As Recordset
Dim strsql As String
strsql = "select * from 题库 where '难度'=2 and '类型'='单选'"
Set rst = dbs.OpenRecordset(strsql)
strsql = "select * from 题库 where 难度='2' and 类型='单选'"
想让label显示还应该加上
set data1.recordset=rstlabel.datafield=xxx
运行到Set rst = dbs.OpenRecordset(strsql)
时出现“标准表达式中数据类型不匹配”