自动将数据从一种形式复制到另一种形式 [英] Copying data from one form to another automatically

查看:100
本文介绍了自动将数据从一种形式复制到另一种形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为某些事情感到困惑,希望有人可以帮助我解决这个问题。


在Access 2000中,我有两种形式......让's'称他们为formA和formB。用户首先将数据输入到formA中。然后在某些情况下,他们需要完成formB。 FormB上的四个控件提取与formA上的4个控件相同的信息。我想在formA上设置一个命令按钮,打开formB并自动填充这4个控件。


我的问题是如何实现这一点。


是否可以使用基于tableA的formA和基于将tableB与tableA中的4个字段组合的查询的formB,从tableA和外键加入主键[ID]来自tableB的[IDtableA]?我不能让这个工作。


充其量,我在formB上创建了一个控件,其中[IDtableA]作为源 - 当我手动输入相应的[ID]号码时,其他相应的字段将自动填充。但是我不想手动输入这个数字。


这两个表格都必须基于同一个表构建吗?我必须将tableB中的字段合并到tableA中才能使其工作吗?如果formB是formA上的子表单,它会自动获取该ID号。通过formA上的命令按钮打开formB时,有没有办法实现这一点?这是一种外部子形态,至少在我看来......


Angi

解决方案

< blockquote>


我一直在为某些东西感到困惑,希望这里有人可以帮我解决这个问题。


在Access 2000中,我有两种形式......让我们称它们为formA和formB。用户首先将数据输入到formA中。然后在某些情况下,他们需要完成formB。 FormB上的四个控件提取与formA上的4个控件相同的信息。我想在formA上设置一个命令按钮,打开formB并自动填充这4个控件。


我的问题是如何实现这一点。


是否可以使用基于tableA的formA和基于将tableB与tableA中的4个字段组合的查询的formB,从tableA和外键加入主键[ID]来自tableB的[IDtableA]?我不能让这个工作。


充其量,我在formB上创建了一个控件,其中[IDtableA]作为源 - 当我手动输入相应的[ID]号码时,其他相应的字段将自动填充。但是我不想手动输入这个数字。


这两个表格都必须基于同一个表构建吗?我必须将tableB中的字段合并到tableA中才能使其工作吗?如果formB是formA上的子表单,它会自动获取该ID号。通过formA上的命令按钮打开formB时,有没有办法实现这一点?这是一种外部子形态,至少在我看来......


Angi



表格之间不需要相关,或者它们可能是相关的,选择权是你的。您只是将数据从一个表单传输到下一个表单。但是,您必须注意的一件事是确保基础字段的数据类型在传输中是一致的。例如,如果您要转移文本值One,从FormA中的[Field1]到FormB中的[Field1],其中[Field1] / FormB中的控制源是数字,最终会得到数据类型不匹配错误。

展开 | 选择 | Wrap | 行号



表格之间不需要相关,或者它们可能是相关的,选择权在您手中。您只是将数据从一个表单传输到下一个表单。但是,您必须注意的一件事是确保基础字段的数据类型在传输中是一致的。例如,如果您要转移文本值One,从FormA中的[Field1]到FormB中的[Field1],其中[Field1] / FormB中的控制源是数字,最终会得到数据类型不匹配错误。

展开 | 选择 | Wrap | 行号



我认为代码中还有一个步骤......有没有办法让它打开FormB到数据录入的新记录?否则,它似乎会覆盖现有记录中的数据。


或者我需要设置FormB,并将数据输入属性设置为yes,并保存与FormC相同的表单,并将数据输入设置为no。审查所有记录?


有没有办法让FormB打开一个新的数据录入记录?

展开 | 选择 < span class =codeDivider> | Wrap | 行号


I''ve been puzzling over something, and hopefully someone here can help me figure it out.

In Access 2000, I have two forms... let''s call them formA and formB. Users enter data first into formA. Then in certain circumstances, they need to complete formB. Four of the controls on FormB pull identical information as 4 of the controls on formA. I want to set up a command button on formA that opens formB and automatically populates these 4 controls.

My question is how to make this happen.

Can it be done with formA based on tableA, and formB based on a query combining tableB with the 4 fields from tableA, joining on the primary key [ID] from tableA and foreign key [IDtableA] from tableB? I can''t get this to work.

At best, I''ve created a control on formB with [IDtableA] as source -- when I manually enter the corresponding [ID] number, the other corresponding fields will populate automatically. But I don''t want to have to enter that number manually.

Do both forms have to be constructed based on the same table? Do my fields from tableB have to be incorporated into tableA to make this work? If formB were a subform directly on formA, it would automatically pick up that ID number. Isn''t there some way to make this happen when opening formB through a command button on formA? It''s kind of an ''external subform'', at least in my mind...

Angi

解决方案

I''ve been puzzling over something, and hopefully someone here can help me figure it out.

In Access 2000, I have two forms... let''s call them formA and formB. Users enter data first into formA. Then in certain circumstances, they need to complete formB. Four of the controls on FormB pull identical information as 4 of the controls on formA. I want to set up a command button on formA that opens formB and automatically populates these 4 controls.

My question is how to make this happen.

Can it be done with formA based on tableA, and formB based on a query combining tableB with the 4 fields from tableA, joining on the primary key [ID] from tableA and foreign key [IDtableA] from tableB? I can''t get this to work.

At best, I''ve created a control on formB with [IDtableA] as source -- when I manually enter the corresponding [ID] number, the other corresponding fields will populate automatically. But I don''t want to have to enter that number manually.

Do both forms have to be constructed based on the same table? Do my fields from tableB have to be incorporated into tableA to make this work? If formB were a subform directly on formA, it would automatically pick up that ID number. Isn''t there some way to make this happen when opening formB through a command button on formA? It''s kind of an ''external subform'', at least in my mind...

Angi

There need be no correlation between the Forms whatsoever, or they may be related, the choice is yours. You are simply transferring data from one Form to the next. The one thing you must be aware of, however, is to make sure the Data Types of the underlying Fields are consistent within the transfer. For instance, if you are transferring the Text Value "One" from [Field1] in FormA to [Field1] in FormB, where the Control Source in [Field1]/FormB is Numeric, you will eventually get a Data type mismatch Error.

Expand|Select|Wrap|Line Numbers


There need be no correlation between the Forms whatsoever, or they may be related, the choice is yours. You are simply transferring data from one Form to the next. The one thing you must be aware of, however, is to make sure the Data Types of the underlying Fields are consistent within the transfer. For instance, if you are transferring the Text Value "One" from [Field1] in FormA to [Field1] in FormB, where the Control Source in [Field1]/FormB is Numeric, you will eventually get a Data type mismatch Error.

Expand|Select|Wrap|Line Numbers


I think there needs to be one more step in the code... is there a way to make it open FormB to a new record for data entry? Otherwise it appears to be overriding the data in an existing record.

Or do I need to set up FormB with the data entry property set to "yes", and save the same form as FormC with data entry set to "no" for reviewing all records?

is there a way to make it open FormB to a new record for data entry?

Expand|Select|Wrap|Line Numbers


这篇关于自动将数据从一种形式复制到另一种形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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