By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,045 Members | 1,743 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,045 IT Pros & Developers. It's quick & easy.

Passing data from one form to another Microsoft Access

P: 4
I have one form, FormA, with multiple fields that populate automatically based on the selection from a combo box. I have another form, FormB, that needs the same information as some of the fields on FormA. Once a selection is made from FormA's combo box and the rest of the fields are populated, I would like the information from some of those fields to automatically be transferred/shared to the corresponding fields on FormB. I am just learning Microsoft Access and have no idea how to go bout doing this. Any help would be greatly appreciated. Thanks!
1 Week Ago #1
Share this Question
Share on Google+
7 Replies


NeoPa
Expert Mod 15k+
P: 31,419
There are different approaches to this depending on whether the data (to be copied) is required for storage elsewhere or simply to be seen on the other Form.

It's possible to copy data across but you really should be very careful of doing that because of the problems with Normalisation it's likely to cause (See Database Normalisation and Table Structures. This is one of the most fundamental and important concepts in database work so overlook at your project's extreme peril).

In concept though, if visibility is required then design your FormB to include that data in its RecordSource. You can use the ID value from whatever's on FormA to filter FormB to include that data.

On the scary chance that you actually want to duplicate this data within the same database you would have to set the values of the FormB Controls to the same as the FormA Controls. Did I mention that's highly perilous? Consider yourself warned!
1 Week Ago #2

twinnyfo
Expert Mod 2.5K+
P: 3,205
kledki,

Welcome to Bytes!

Your question does not sound like rocket science, but it is difficult to provide an answer when we know so little about your project.

First, are the two forms open simultaneously or is FormB a Sub-Form on FormA? How does FormA "populate automatically"? Does the data populate from an underlying table? What is the record source of FormB? If you are able to populate the controls of FormA, I would assume you could perform a similar task on FormB? Additionally, what is the necessity for having two forms with identical/nearly identical data? Does the data save to two different tables? If so, then that begs the question of having those two tables separate.

As you can see, lots of questions. We are willing to hepp! We just need a little more information.

If you post the code that populates FormA and then describe in more detail what it is you are trying to do, we can try to work you toward a solution.

Thanks!

Hope that hepps!
1 Week Ago #3

P: 4
They are independent forms, open simultaneously. FormA is called "Production Report" and FormB is called "Quality Record." There is also a table called "Product Master Data." This table is the record source for FormA. The top field on FormA is a combo box called "Protean Resource" and once a resource is selected from the combo box, all of the fields beneath it on FormA are populated with the information for the corresponding record in the Master Data table. FormB has a few fields that are the same as on FormA. What I am trying to do is find a way for those fields on FormA to automatically copy to the corresponding fields on FormB so that it doesn't have to be entered again.
1 Week Ago #4

twinnyfo
Expert Mod 2.5K+
P: 3,205
What is the record source for "Quality Record"? At this point, I'm not seeing a need to have a second form--but that's just because I don't know what you are trying to do with the transfer of this data.

Also, for the "Protean Resource" combo box, I am guessing that you are simply filtering the data on the form? This would be a typical approach, but, again, you have not provided more detailed answers.

What I am trying to do is understand the need for copying data. As mentioned by NeoPa, there is very seldom a need to copy a record's data like this, so if we can find a way to make this work using better principles of db design, that's the direction we will try to take you...
1 Week Ago #5

NeoPa
Expert Mod 15k+
P: 31,419
I'm with Twinny on this one. It seems like you want to copy data that is already available into a different table. This is in spite of the very strong warnings against such an approach found in my earlier post and also in the linked article on data normalisation.

My guess is that you need to redesign in such a way as to keep that common data out of these tables and have a separate table to contain such data while having linking FK indices into that table from both of the ones you're managing with your two forms.
1 Week Ago #6

P: 4
Thanks for your help. I've decided to take both of your advice and rethink my approach!
6 Days Ago #7

NeoPa
Expert Mod 15k+
P: 31,419
Good to hear. Sorry if it's a pain, but it would surely be worse if you didn't I'm afraid.
5 Days Ago #8

Post your reply

Sign in to post your reply or Sign up for a free account.