输入新数据时,表单中的组合框会发生变化 [英] Combo Boxes in a Form change when entering new data

查看:46
本文介绍了输入新数据时,表单中的组合框会发生变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有固定列表框的表格,其中包含人名和地址。在这些之下,我有组合框,所以我可以手动输入电话号码,电子邮件等数据。如果信息已经存在,我只需查看并打印报告。如果没有,我添加数据。


我的问题是,在我手动将数据输入组合框后,选择下一个组合框后,字段(所有这些)都会发生变化。似乎发生的是表单恢复到第一个列表(按字母顺序排列),而不是让我继续填写我需要的信息。因此,我必须在一个框中输入数据,然后我必须通过列表向后滚动,找到我想要使用的选项,输入更多数据,并为每个组合框重复。


有没有办法让表格不变,所以我可以保留我想要的选择,填写空白(或进行更改)并转到报告?


注意:组合框中的大多数字段在表格中都是空白的,它们会经常更改。


谢谢。

I have a form with fixed list boxes which are of the persons name and address. Below those, I have Combo Boxes so I can manually enter data like phone number, email, etc. If the information is already there, I simply review and print the Report. If not, I add the data.

My problem is that after I manually enter data into a Combo Box, upon selecting the next Combo Box, the fields (All of them) change. What seems to happen is that the form reverts to the first listing (alphabetical) rather than allowing me to simply continue filling out the information I need. So I am having to enter data in one box and then I have to scroll back thru the listings, find the selction I want to work with, enter more data, and repeat for each Combo Box.

Is there a way to keep the form from changing so I can remain on the selection I want, fill out the blanks (or make changes) and go to the report?

Note: Most fields from the Combo Boxes are blank in the table and they will change often.

Thanks.

推荐答案

编写哪些事件来执行某些操作?每个文本框的After_Update事件中有什么东西?


Jim
What events are coded to do some action? Something in the After_Update event of each textbox?

Jim


Private Sub Combo40_AfterUpdate()

''查找与控件匹配的记录。

Dim rs As Object


设置rs = Me.Recordset.Clone

rs.FindFirst" ; [付款] =''" &安培;我![Combo40]& "''"

如果不是rs.EOF那么Me.Bookmark = rs.Bookmark

End Sub
Private Sub Combo40_AfterUpdate()
'' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Payment] = ''" & Me![Combo40] & "''"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


所以没有想知道组合框以及表单上的所有其他数据项在更改组合框中的值时会发生变化。此代码将寻找与[Payment]匹配组合框中条目的第一条记录。如果所有组合框都具有相似的逻辑,那么每次更改任何组合框时,表单可能会更改为不同的记录。


您只想在组合框上使用此类代码你正在用来查找记录;查找要编辑的记录后,无需切换到其他记录。您的查找组合框不应该真正绑定到正在查找的记录,它应该是一个未绑定的对象。


Jim
So no wonder the combo boxes, and every other data item on the form, are changing when you change the value in the combobox. This code is going out to look for the first record that matches the [Payment] to the entry in the combo box. If all the combo boxes have similar logic, then every time you change any combo box the form possibly changes to a different record.

You want this sort of code only on the combo box that you are using to look up a record; after you look up the record you want to edit it without switching to a different record. Your lookup combo box should not really be bound to the record being looked up, it should be an unbound object.

Jim


这篇关于输入新数据时,表单中的组合框会发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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