onLoad:在由SQL填充的组合框中显示存储的值 [英] onLoad: display stored value in a combobox filled by SQL

查看:46
本文介绍了onLoad:在由SQL填充的组合框中显示存储的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



组合框正确填充,当我选择一个项目时,所选项目将通过_AfterUpdate代码放入数据库。


行源:



the combobox is filled correctly and when I choose an item, the selected item is put into the DB by _AfterUpdate code.

Row source:

展开 | 选择 | Wrap | 行号

推荐答案

Form_Load是On Load事件的子名称。如果要从另一个表中查找要在表单上显示的值,最简单的方法是DLookup。但是,如果您想要来自同一记录的多个值,打开记录集并移动到可以获取值的正确记录可能会稍快一些,而不是执行多个DLookup。
Form_Load is the name of the sub for the On Load event. If you want to look up a value from another table to display on your form, the easiest way would be DLookup. However, if you want several values from the same record, it may be slightly faster to open a recordset and move to the correct record where you can grab the values, rather than do multiple DLookups.



Form_Load是On Load事件的子名称。
Form_Load is the name of the sub for the On Load event.



如果form_load只是名称,我应该在表单加载时触发操作。对不起,我不是英文,那句话让我感到困惑..


好​​,表格实际上是所选软件的记录,你可以编辑任何信息(序列号) ,版本等..)。另一种形式仅供浏览(但这不会改变问题)。其他字段不会造成任何麻烦,因为打开记录时查找是自动的(由于控制源我认为?)


组合框是未绑定的(控制源为空) )。问题是该记录是针对软件的,并且大部分信息来自通过访问自动填充的软件表。这些组合框不是。要显示的信息来自另一个表,基于当前记录信息。并且它们是未绑定的因为我无法通过''记录源'获得想要的结果。

What should I put then to trigger an action when the form loads if form_load is just the name. Sorry, I''m not english and that sentence is confusing me..

well, the form is actually the record of the chosen software, where you can edit any information (serial number, version, etc..) . Another form is available for browsing only (but this doesn''t changes the problem). The other fields don''t cause any trouble since the lookup is automatic when opening the record (due to control source i suppose?)

the combobox is an unbound one (control source empty). The problem is that the record is for software and most of information comes from the software table filled in automaticilly by access. These comboboxes are not. The info to display comes from another table, based on the current record info. And they are "unbound" because I can''t get the wanted result with ''record source''.


此表单是否允许您更改记录?如果您只想在表单打开时执行此操作,请使用Private Sub Form_Open和Private Sub Form_Open。如果你想在每次选择记录时运行代码,而是使用Private Sub Form_Current。您始终可以在设计视图,事件选项卡中单击表格属性,单击省略号,然后选择代码构建器。并让它为你创建程序。


我无法弄清楚你是否有一个组合框或多个组合框,是否有一个RowSource设置,或者它们是什么应根据当前表单中的外键查找。
Does this form allow you to change records? If you just want to do this when the form opens, use "Private Sub Form_Open" and if you want to run the code every time a record is selected, instead use "Private Sub Form_Current." You can always go to the form properties in design view, event tab, click the elipsis, and select "code builder" and have it create the procedure for you.

I can''t figure out whether you have one combo box or multiple ones, whether they have a RowSource set or not, or what they are supposed to look up based on what foreign key from your current form.


这篇关于onLoad:在由SQL填充的组合框中显示存储的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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