MS Access在新记录上填充表字段 [英] MS Access populate table fields on new record

查看:77
本文介绍了MS Access在新记录上填充表字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请耐心等待。我没有做太多的vba开发,所以我缺乏对进程和语法的了解。


我有一个包含六个子表单的表单。要打印我需要的报告,我需要填充每个子表单中的某些字段。我在表单中使用组合框。实现这一目标的最佳方法是什么?我有每个组合框设置的默认值,但它没有在正确的表中填充数据字段,直到我用鼠标实际选择默认值。


我目前的想法是插入VB 添加记录中的代码主窗体上的按钮。这有可能吗?我应该直接填写字段,还是编写选择每个组合框的代码?我将在添加记录中添加什么代码按钮。代码会是什么样的?

Please bear with me. I don''t do much vba development, so my knowledge of process and syntax is lacking.

I have a form with six subforms. To print my required reports, I need to have certain fields in each subform populated. I am using combo boxes in the forms. What would be the best method to accomplish this? I have the defaults for each combobox set, but it is not populating the data field in the proper table until I physically choose the default with the mouse.

My present thought is to insert VB code in the "Add Record" button on the main form. Is this a possibility? Should I directly fill in the fields, or write code that would choose each combobox? What code would I put in the "Add Record" button. What would the code look like?

推荐答案

嗨BigEd。


很明显你已付出了一些努力充分表达你的问题,这本身就很重要。但是,作为一个读者,我必须说我没有清楚地知道你要求的是什么。


也许你可以通过这个过程来思考它试着一步一步向我们描述。了解表格中的内容以及报告中的内容可以使我们朝着正确的方向前进,并使我们能够更清楚地理解其余的解释。


万一它有帮助,而且我在这个阶段的理解非常模糊,所以它可能偏离目标,级联表单过滤可能是您所追求的,或者至少是其中的一部分(当然可能根本不是)。
Hi BigEd.

It seems clear that you''ve put some effort into expressing your question fully, which is important in itself. However, as a reader, I must say that I come away without a clear idea of what you''re asking for.

Perhaps you could think through the process as you see it and try to describe that to us step by step. An idea of what''s on the form(s) and what on the report whould lead us in the right direction and enable us to understand the rest of the explanation more clearly.

In case it helps, and my understanding at this stage is very fuzzy so it may be way off target, Cascaded Form Filtering may be what you''re after, or at least part of it (or maybe not at all of course).


BigEd1977,


请记住,当您移动到新记录时,字段/控件的默认值仅影响基础表。如果您在现有记录上打开表单,将显示基础值。


我想我有点理解你想要做什么,但如果你给我们更多你希望发生什么的具体例子,这可能会帮助我们更清楚地理解你的问题。我知道 为什么 你试图从你以前的线程中做到这一点,但 是什么 仍然有点模糊。


谢谢!
BigEd1977,

Keep in mind that the default value for a Field/Control only affects the underlying table when you move to a new record. If you are opening your form on an existing record, the underlying values will be shown.

I think I kind of understand what you are trying to do, but if you give us a more concrete example of what you want to happen, that might help us understand your problem a bit more clearly. I know why you are trying to do this from your previous thread, but the what is still a bit fuzzy.

Thanks!


谢谢你们。

让我再试一次。


我有一个包含六个子表单的表单。我有一份报告,从所有表格中获取数据,然后对其进行总结。该报告有六个子报告,每个表单一个。我发现,如果子窗体中没有数据,子报表将不会打印。有一些关键控件/字段需要包含数据才能使报告正确打印。


每个具有所需控件/字段的子窗体都有组合框作为控件。我将组合框设置为属性中的默认数据,并在生成主窗体中的新记录时显示默认值。除非我转到子窗体并单击组合框中的选区,否则不会打印子报表。我选择了组合框中的默认值,即使它已经显示,也会打印子报表。


我的目标是在生成新记录时让每个子表单中的组合框填充子表格中的正确字段。


Main记录是:订单使用名为tblOrder的表

子记录是:Burgers有一个名为tblBurgers的链表每个订单记录可以有多个汉堡记录。


汉堡记录/表中的字段需要在创建订单时填充。要打印的报告的记录。


链接到tblOrder的其他表是:tblSausage,tblStuffedSausage,tblHunterSticks,tblJerky。每个表中都有字段,味道,调味品,premiumseasoning,需要填写订单记录的创建。


这有意义吗?
Thanks guys.

Let me try again.

I have a form that includes six subforms. I have a report that takes the data from all of the forms, then summarizes it. That report has six subreports, one for each form. I have found that if there is no data in a subform that the subreport will not print. There are key controls/fields that need to have data in them for the report to print correctly.

Each subform that has the required controls/fields have comboboxes as the controls. I have the comboboxes set to default data in the properties, and they show the default when a new record in the main form is generated. Unless I go to the subform, and click a selection in the combobox, the subreport does not print. I choose the default in the combobox, even though it is already being displayed, and the subreport prints.

My goal is to have the comboboxes in each subform populate the proper fields in the subform table when a new record is generated.

Main record is: Order With a table named tblOrder
Sub record is: Burgers With a linked table named tblBurgers There can be multiple burger records per Order record.

There are fields in the burger record/table that need populated at the creation of the "Order" record for the reports to print.

Other tables linked to tblOrder are: tblSausage, tblStuffedSausage, tblHunterSticks, tblJerky. There are fields, flavor, seasoning, premiumseasoning, in each of these tables that need populated with the create of the Order record.

Does that make sense?


这篇关于MS Access在新记录上填充表字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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