Access 2007-在窗体上查找记录命令按钮不起作用 [英] Access 2007- Find a Record Command Button on Form Doesn't Work

查看:399
本文介绍了Access 2007-在窗体上查找记录命令按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。


我是Microsoft Access新手,一直在创建数据库来存储记录,添加新记录,更新记录,删除记录,搜索记录,创建报告记录等


说到这里,我在这个过程中几乎没有经验,并且在我去的时候一直在自学。但是,我现在卡住了,因为我创建了一个更新记录表单来更新存储在表中的现有记录,其中查找记录按钮不再有效。


当我第一次创建查找记录命令按钮时,它工作得很漂亮,就像预期一样,这很奇怪,因为我甚至没有为它创建代码。我花了HOURS研究和试错,试图让这个按钮再次运行,尝试不同的VBA代码,没有运气。两次,查找记录按钮实际工作,当我保存我的更改后退出表单,然后重新进入并尝试它,它再次停止工作。我不明白。


我需要创建一个VBA代码,允许我根据13个字段中的任何一个来查找记录。例如,如果有人想根据文件类型,所有者或文档编号等进行搜索,我需要按钮才能工作。


有人可以帮忙吗?!


谢谢。

Hello everyone.

I am new to Microsoft Access and have been creating a database to store records, add new records, update records, delete records, search records, create reports from records, etc.

With that said, I have little experience in this process and have been teaching myself as I go. However, I am now stuck because I created an Update Record Form to update existing records that are stored in a table with a find record button that no longer works.

When I first created the Find Record Command Button it worked beautifully, just as intended, which was strange because I had not even created a code for it. I have spend HOURS researching and trial and error trying to get this button to work again by trying different VBA codes and no luck. Twice, the find record button actually worked and when I exited the form after saving my changes, and went back in and tried it, it stopped working again. I don''t understand.

I need to create a VBA code that allows me to find a record based upon any of 13 fields. For instance, I need for the button to work if someone wanted to search according to File Type, or Owner, or Document Number, and so forth.

Can someone please help?!

Thank you.

推荐答案

好吧,我觉得为了帮助我们需要知道按钮当前是怎么回事程序。按下它时它究竟执行了什么?我们可以将它作为起点并从那里开始。


另外,为了使这个变得简单,我们假装你在一个字段上搜索。如果我们可以解决一个现场案例的问题,那么其他案件就应该落实到位。
Well, I think in order for us to help we need to know how the button is currently programmed. What exactly is it executing when you press it? We can use that as a starting point and go from there.

Also, for the purposes of making this simple, we''ll pretend that you are searching on one field. If we can fix your problem for the one field case, then the others should fall into place.


Hi Pat。非常感谢你的回复。我是Access的新手,所以我会尽我所能尽力回答你的问题。


O.k.所以我有一个FormUpdateCMRecord,它由一些文本框和组合框组成。组合框被查询到我的tblCMRecords,其中包括一个表中记录的所有字段。例如,该表包括文档号,文件类型,修订版,标题,所有者,图书馆,状态,资金来源, 费用编号,项目,制造商,制造商部件编号和注释。这些是我表中存储我需要能够搜索的数据的所有字段。


我使用了命令按钮向导并在我的页脚底部添加了一个按钮。我的表格部分。上面列出的所有字段都被格式化为详细信息中的文本框和组合框。我的表格部分。标题更新配置记录位于标题中的标题位于标题中。我的表格部分。


我按照命令按钮提示并选择了记录导航。类别和查找记录行动。然后我将我的按钮命名为查找和更新记录。


此外,我添加了一个退出到CM菜单。命令按钮按预期工作。


我希望能够按下查找和更新记录命令按钮并使其根据文档编号搜索记录。例如,从10001开始。


我试图在这里尽可能包容,并尽可能多地提供给你的信息。如果我没有回答您的问题,请告诉我,我会尽力再次回答。


非常感谢您的回复,希望对您有所帮助!
Hi Pat. Thank you so much for your response. I am very new to Access, so I am going to do my best to answer your question to the best of my ability.

O.k. so I have a "FormUpdateCMRecord", which consists of some text boxes and combo boxes. The combo boxes are queried to my "tblCMRecords", which includes all fields for the records in the one table. For instance, the table includes the "Document Number", "File Type", "Revision", "Title", "Owner", "Library", "Status", "Funding Source", "Charge Number", "Project", "Manufacturer", "Manufacturer Part Number", and "Comments". These are all of the fields in my table that store the data I need to be able to search for.

I used the command button wizard and added a button to the bottom of my "Footer" section of my form. All of the fields listed above are formatted into text boxes and combo boxes in the "Detail" section of my form. The title "Update Configuration Record" is located in the "Header" section of my form.

I followed the command button prompts and selected the "Record Navigation" category and "Find Record" action. I then named my button "Find and Update Record."

In addition, I added an "Exit to CM Menu" command button that works as intended.

I want to be able to press the "Find and Update Record" command button and have it search for a record according to "Document Number" for instance, which begins at 10001.

I tried to be as inclusive as knowingly possible here and give you as much information as I can. If I am not answering your question, please let me know and I will do my best to try and answer it again.

Thank you so much for your response and I hope this helps!


实际上,命令按钮的名称是btnUpdateRecord。标题是查找和更新记录。
And actually, the command button''s Name is "btnUpdateRecord" and the Caption is "Find and Update Record."


这篇关于Access 2007-在窗体上查找记录命令按钮不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆