检查记录是否存在打开表格

编程入门 行业动态 更新时间:2024-10-27 08:26:43
本文介绍了检查记录是否存在打开表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好,再次感谢您花时间帮助解决我的问题! 这个问题在我看来似乎非常简单,但是让编码让它工作是确定不是那么简单... 基本上我要做的是检查命令按钮以查看当前的记录ID是否正确。存在于姐妹表中,然后在用户点击它时打开姐妹表的绑定表单进行编辑。 我想我可以通过SELECT查询来搜索当前记录的记录ID。在姐妹表中,并将其与If Then相结合。声明将 a)允许访问表单或 b)如果SELECT查询的结果为空或空并且禁止访问,则弹出一个MsgBox。 从我的研究中,下面的代码应该可以工作,但Access一直挂在Dim db As Database上。线,我不能为我的生活搞清楚!

Hello guys, thanks again for taking the time to help me out with my problems! This problem seems super simple in my head, however getting the coding to make it work is turing out to be not so simple... Basically what I am trying to do is have a Command Button check to see whether the current "Record ID" exists in the sister table before opening the sister table''s bound form for editing when the user clicks on it. I figured that I would be able to do this with a SELECT query that does a search for the current record''s "Record ID" in the sister table, and couple it with an "If Then" statement that will either a) allow access to the form or b) pop up a MsgBox if the results of the SELECT query are Null or Empty and disallow access. From my research the code below should work, but Access keeps getting hung up on the "Dim db As Database" line, and I cannot for the life of me figure it out!

展开 | 选择 | Wrap | 行号 推荐答案

检查您是否有对Microsoft DAO对象库的引用。同样,在声明数据对象时,您应该使用对DAO或ADO对象库的完整引用。 Check that you have a reference to Microsoft DAO Object Library. Also when declaring data objects you should use the full reference to a DAO or ADO object library. 展开 | 选择 | Wrap | 行号

检查您是否有对Microsoft DAO对象库的引用。同样,在声明数据对象时,您应该使用对DAO或ADO对象库的完整引用。 Check that you have a reference to Microsoft DAO Object Library. Also when declaring data objects you should use the full reference to a DAO or ADO object library. 展开 | 选择 | Wrap | 行号

对不起,我在上一篇文章中应该更清楚地检查你的参考资料。 你需要去工具>从VBA编辑器窗口引用并确保您已包含Microsoft DAO对象库。 Sorry I should have been more clear in my previous post about checking your reference. You need to go to Tools > References from the VBA editor window and ensure that you have included the Microsoft DAO Object Library.

更多推荐

检查记录是否存在打开表格

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

发布评论

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

>www.elefans.com

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