按唯一ID文本框或名称组合框搜索 [英] Searching by unique ID text boxes or name combo boxes
问题描述
我有一个员工的Access数据库。
每个员工都有一个名为BANNER_ID的唯一识别号码。
每个员工的姓氏和名字在数据库中,但不是唯一的(显然)。
数据存储在名为EMPLOYEE的表中。
我想创建一个搜索选项,借此经理可以通过输入数字并按下名为搜索的命令按钮,按BANNER_ID
搜索员工。
我想要创建一个随附的搜索选项,管理员可以通过从组合框(LAST_NAME)中选择他或她的姓氏来搜索员工
,然后从
另一个组合框中输入名字( FIRST_NAME)。
当选择姓氏时,我希望名字的组合框缩小到只有与所选姓氏相关联的
名字。
我希望两种搜索选项都可用/>
我得到了以下代码的帮助,该代码根据他们的
姓氏搜索员工。但是,我无法使其适应上面列出的新需求。
I have an Access database of employees.
Each employee has a unique identification number called "BANNER_ID".
Each employee''s last name and first name are in the database but are not unique (obviously).
The data is stored in a table named EMPLOYEE.
I want to create a search option whereby managers can search for an employee by "BANNER_ID"
by entering the number and pressing a command button named "Search".
I want to create an accompanying search option whereby managers can search for an employee
by selecting his or her last name from a combo box (LAST_NAME) and then first name from
another combo box (FIRST_NAME).
When a last name is selected, I would like the combo box of first names to narrow to only
first names that are associated with the selected last name.
I want both search options to be available.
I have been helped with the following code that searches for employees based on their
last name. However, I am having trouble adapting it to work with my new needs listed above.
推荐答案
级联组合/列表框教程将帮助您设置这些组合框。
The Cascading Combo/List Boxes tutorial will help you set up those comboboxes.
我查看了组合框教程以及其他一些信息。我现在有一个组合框,限制第二个组合框中的选项,这两个组合框都在列表中显示所选结果(完全按照我的意愿 - 谢谢!)。现在,我希望能够在列表中选择一条记录,从而打开另一个包含记录详细信息的表单。这是我的搜索中包含的代码。子表单:
I have looked over the combo boxes tutorial as well as some other information. I now have a combo box that limits the options in the second combo box, both of which display the selected results in a list (exactly as I wanted it - thank you!). Now, I want to be able to select a record in the list and thereby open another form that contains the detailed information of the record. Here is the code included in my "search" subform:
如果Banner_ID是文本,则必须用引号括起来,所以:
If Banner_ID is text you have to surround it with quotes, so:
这篇关于按唯一ID文本框或名称组合框搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!