Copy data from subform into from and then store in a table?

T

T0My

I have a subform associated with tableA and form associated with
tableB. Subform is linked to a form in a way that when I select ID of
record from tableA the rest of data from that record autofill into the
form. All the data are now displayed in form but I dont know how to
store all that data in a tableB. When I enter record in form in tableB
is just stored ID of record and the rest of the data are blank. How
can I store all the data dispayed in a form to a TableB??? Can somebody
please help me I'm a beginner.
 
S

Steve Schapel

T0My,

It is not clear how you have your form and subform set up. Could you
give some more specific details please, regarding your tables and
fields. The normal way this works is that there is a one-to-many
relationship between the tables, with the table on the 'many' side of
the relationship being the record source of the subform. Is that what
you have? Normally, if you have controls in a subform that look upo
data from another table, you do not want these data to be saved to a
second table... that's the whole point of using a relational database -
the 'looked up' data is always available via the relationship, so does
not need to be stored a second time.

Anyway, it will be easier to discuss if we can relate to your specific data.
 
J

John Vinson

I have a subform associated with tableA and form associated with
tableB. Subform is linked to a form in a way that when I select ID of
record from tableA the rest of data from that record autofill into the
form. All the data are now displayed in form but I dont know how to
store all that data in a tableB. When I enter record in form in tableB
is just stored ID of record and the rest of the data are blank. How
can I store all the data dispayed in a form to a TableB??? Can somebody
please help me I'm a beginner.

Are you trying to copy all of the data from TableA into TableB? If
so... DON'T!!!

Databases use the "Grandmother's Pantry Principle": "A place - ONE
place! - for everything, everything in its place". If you store the
data in TableA, then that is the ONLY place it need be or should be
stored; you can link to it using a Query, a Form and Subform, or in
other ways if you need to see it in conjunction with data from another
table.

John W. Vinson[MVP]
 
N

Naeem Azizian

Are you storing new data in the subform and that data disappears when
you close the subform along with the (parent) form?
then there is no relation set between your TableA and TableB. Normally
access fills in the foreign key field in the subform if you have
created it or linked it via wizard (foreign key is the key field to
finding the data in your child table related to the main table). if you
are new to access, then here is what you need to do:
1- create a relationship between the TableA(primary key-one side table)
and TableB (foreign key- many side table).
2- delete the subform from the form.
3- insert the subform via wizard again.
 
T

T0My

Steve Schapel je napisao/la:
T0My,

It is not clear how you have your form and subform set up. Could you
give some more specific details please, regarding your tables and
fields. The normal way this works is that there is a one-to-many
relationship between the tables, with the table on the 'many' side of
the relationship being the record source of the subform. Is that what
you have? Normally, if you have controls in a subform that look upo
data from another table, you do not want these data to be saved to a
second table... that's the whole point of using a relational database -
the 'looked up' data is always available via the relationship, so does
not need to be stored a second time.

Anyway, it will be easier to discuss if we can relate to your specific data.
Yes, I have one to many relationship between tables and the record
source for the subform is the table on the 'many' side of the
relationship. In TableB there is IDb and other data fields. In TableA
there is IDa, data fields and IDb along with two data fields from
TableB. I understand that fields can be reached through relationships,
but my problem is how can I get all the data fields together in a
report (data from TableA with data from TableB in a same report).Is
this posible with some kind of query?
 
S

Steve Schapel

T0My,

Yes, you would base your report on a query that includes both tables,
joined on the ID field in common. This idea is at the core of much
database work. Without knowing the nature of the data, I cannot be 100%
difinitive (as there are sometimes exceptions to the rule), but I would
think it is incorrect to have the two data fields from TableB included
in TableA. You can remove these fields from TableA. From the TableA
point of view, you will always know what these values are by reference
to the corresponding TableB records.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top