我希望在打开表单时显示与表单关联的所有记录。我希望每个记录都通过特定的表格编号与表格相关联。
I would like to have all of the records associated to a form displayed when the form is opened. I would have each record be associated to a form by a specific form number.
最有效的方法是什么?
谢谢
nick
推荐答案
尼克,
回顾你的问题:数据库调用中有一个字段"表单编号"。您希望创建一个表单,然后选择与特定表单关联的所有记录,并仅显示这些记录。这是正确的吗?
Recap of your question: There is a field in the database call "form number". You want to create a form that then selects all of the records asssociated with a specific form and display just those records. Is that correct?
此外,这是一个仅显示表格还是数据输入表格?
Also, is this a display only form or a data entry form?
是非常具体的表格编号还是生成的在飞行中?我的问题的原因是当用户想要显示与特定表格相关联的记录时,他们可以从下拉框中选择还是必须输入表格编号?
Are the very specific form numbers or are the generated on the fly? The reason for my question is when the user wants to display the records associated with a specific form, can they select from a drop down box or do they have to enter the form number?
For在这种情况下,我将假设您将有一个特定表格编号及其名称的下拉框。
For this dicussion, I will assume that you will have a drop down box of specific form numbers and their names.
1.创建表单。如果您不希望在用户选择表单编号之前显示任何内容,则可以将表单的数据输入属性设置为是。您可能想要更改表单的默认视图属性单一表格至连续表格。
1. Create a form. If you do not want anything to be displayed until the user selects a form number, you can set the form's Data Entry property to Yes. You may want to change the form's Default View propertyfrom Single Form to Continuous Form.
2.在表单的标题中创建一个组合(下拉)框/控件。您可以使用表单编号和表单名称预先加载组合框。
2. Create a combo(drop down) box / control in the header of the form. You can preload the combobox with form numbers and form names.
3.在组合框的After Update事件中,您可以输入以下代码:
3. In the combo box's After Update event, you can put the following code:
Private Sub cboFormNo_AfterUpdate()
Private Sub cboFormNo_AfterUpdate()
Dim strFilter as String
Dim strFilter as String
'按表格编号/名称过滤输入文件 '然后重新查询表单
' Filter input file by Form Number / Name ' Then Requery the form
strFilter =" FormNo =" &安培; Me.cboFormNo Me.Filter = strFilter Me.FilterOn = True Me.Requery
strFilter = "FormNo= " & Me.cboFormNo Me.Filter = strFilter Me.FilterOn = True Me.Requery
End Sub
过滤器只会显示字段FormNo等于组合框中选择表单编号的记录。
The filter will then only show those records where the field FormNo is equal to the select form number in the combo box.
如果需要,我们也可以进行设置,这样如果用户双击特定行,我们就可以使用用户点击的特定记录执行相关表单。 。
If you want, we can also set it up so that if the user double clicks on a specific row, we can the execute the associated form with the specific record that the user clicked on.
丹尼斯
更多推荐
如何在打开表单时显示记录?
发布评论