作用于空记录集

编程入门 行业动态 更新时间:2024-10-22 20:20:21
本文介绍了作用于空记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

hiya, 除了以下 之外,还发现了我需要的所有内容: 我想生成一些代码允许我在 组合中输入一个字符串,然后根据表格中的字段进行检查。然后,我想要一个消息框,告诉我是否有匹配或 没有。简单!我不知道我是否会绕着房子走,但是 以后几乎可以工作: Dim db作为数据库 Dim rs As DAO.Recordset Dim strsql As String Dim Ref as Integer strsql =" select * from [first] where [codey] =(''"& Forms![Form4]!Combo10.Column(1)&"'')" 设置db = CurrentDb() 设置rs = db.OpenRecordset(strsql) 如果不是(IsNull(rs.Fields( 狡猾)))然后 MsgBox没有 否则 MsgBox是 结束如果 我没有收到任何错误但我每次都得到相同的答案 无论我是否有比赛 在此先感谢 Chriso

解决方案 >如果不是(IsNull(rs.Fields(codey)))那么 **将此行替换为: 如果不是rs.Recordcount然后 - Bruce M. Thompson,Microsoft Access MVP bt ****** @ mvps (请参阅访问常见问题解答 www.mvps/access )

没有电子邮件请。在新闻组中保留所有通信

,以便所有人都可以受益。<<

c。******** @ blueyonder.co.uk (crisox)在留言新闻中写道: < 31 ************************** @ posting.google。 com> ...

hiya,除了下面的之外,我发现了我需要的所有内容:我想制作一些允许我的代码在组合中输入一个字符串,然后根据表格中的字段进行检查。然后我想要一个消息框,告诉我是否有比赛或不是。简单!我不知道我是否会绕着房子走,但是接下来的工作非常接近: Dim db As Database Dim rs As DAO.Recordset Dim strsql As String Dim Ref as Integer strsql =" select * from [first] where [codey] =(''"& Forms![Form4] !Combo10.Column(1)&"'')" 设置db = CurrentDb()设置rs = db.OpenRecordset(strsql) > If Not(IsNull(rs.Fields(codey)))然后 MsgBox没有 其他 MsgBox" ;是" 结束如果 我没有得到任何错误,但我每次都得到相同的答案无论我是否有匹配 先谢谢 Chriso

而不是: 如果不是(IsNull .. 。) 尝试 如果不是rs.BOF = rs.EOF

在comp.databases中于2004年2月11日星期三19:11:19 -0500 .ms-access,Bruce M. Thompson < bthmpson@big_NOSPAM_foot>写道:

如果不是(IsNull(rs.Fields(" codey")))那么

**将此行替换为: 如果不是rs.Recordcount那么

小心使用非布尔值的按位运算符,结果 可能不如预期。 - A)bort,R)etry,I)用大锤子影响。

hiya, Found just about everything I need on this group apart from the following: I want to produce some code that allows me to enter a string in a combo which will then be checked against a field in a table. I then want a message box to appear telling me whether there is a match or not. Simple! I dont know whether I''m going round the houses but the following very nearly works: Dim db As Database Dim rs As DAO.Recordset Dim strsql As String Dim Ref As Integer strsql = "select * from [first] where [codey] = ( '' " & Forms![Form4]!Combo10.Column(1) & " '') " Set db = CurrentDb() Set rs = db.OpenRecordset(strsql) If Not (IsNull(rs.Fields("codey"))) Then MsgBox "no" Else MsgBox "yes" End If I dont get any errors but I do get the same answer everytime regardless of whether I have a match or not Thanks in Advance Chriso

解决方案

> If Not (IsNull(rs.Fields("codey"))) Then **Replace this line with: If Not rs.Recordcount Then -- Bruce M. Thompson, Microsoft Access MVP bt******@mvps (See the Access FAQ at www.mvps/access)

NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<

c.********@blueyonder.co.uk (crisox) wrote in message news:<31**************************@posting.google. com>...

hiya, Found just about everything I need on this group apart from the following: I want to produce some code that allows me to enter a string in a combo which will then be checked against a field in a table. I then want a message box to appear telling me whether there is a match or not. Simple! I dont know whether I''m going round the houses but the following very nearly works: Dim db As Database Dim rs As DAO.Recordset Dim strsql As String Dim Ref As Integer strsql = "select * from [first] where [codey] = ( '' " & Forms![Form4]!Combo10.Column(1) & " '') " Set db = CurrentDb() Set rs = db.OpenRecordset(strsql) If Not (IsNull(rs.Fields("codey"))) Then MsgBox "no" Else MsgBox "yes" End If I dont get any errors but I do get the same answer everytime regardless of whether I have a match or not Thanks in Advance Chriso

Instead of: If Not (IsNull...) Try if not rs.BOF=rs.EOF

On Wed, 11 Feb 2004 19:11:19 -0500 in comp.databases.ms-access, "Bruce M. Thompson" <bthmpson@big_NOSPAM_foot> wrote:

If Not (IsNull(rs.Fields("codey"))) Then

**Replace this line with: If Not rs.Recordcount Then

Be careful using bitwise operators on non boolean values, the result may not be as expected. -- A)bort, R)etry, I)nfluence with large hammer.

更多推荐

作用于空记录集

本文发布于:2023-10-25 13:45:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1527125.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作用于   记录集

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!