Exporting data from a form to a table

M

Metal Goggles

I would like to know how to export data entered on a form to a different
table than what it is based on. Here is what I am trying to do. I have
Table A (Orders) and Table B (Orders Received). For each table I have a form
to populate each table. On Table A (Orders) I have a Field
(DateLastPieceShipped) and (Completed check box). My Form B (Orders
Received) is where I need to enter the data. I need this data be inserted
into my Table A (Orders). Is this possible and how would I go about doing
it. Does this have to be coded in VBA?

Any help would be appreciated.
 
A

Allen Browne

Are you really sure you want to create the maintenance nightmare for
yourself? It is much easier to just ask Access to calculate the most recent
date than it is to store it and make sure you have it right regarless of how
records are added, deleted, or modified.

Instead of storing the date, just put something like this into the Control
Source of the text box on the main form where you want the date displayed:
=DMax("SomeDate", "TableB", "([OrderID] = " & Nz([OrderID], 0) & ") AND
([Completed] = True)")


If you really want the trouble of maintaing a stored value, use DMax() in
the AfterUpdate and AfterDelConfirm events of the subform to read the value
directly from the subform's table, and if different write the result to the
text box on the Parent form and set its Dirty property to False to save it.
Remember to do that after executing any append/delete/update query, and
don't let anyone alter values directly in the table or query.
 
D

dongfangbooks

Allen Browne said:
Are you really sure you want to create the maintenance nightmare for
yourself? It is much easier to just ask Access to calculate the most recent
date than it is to store it and make sure you have it right regarless of how
records are added, deleted, or modified.

Instead of storing the date, just put something like this into the Control
Source of the text box on the main form where you want the date displayed:
=DMax("SomeDate", "TableB", "([OrderID] = " & Nz([OrderID], 0) & ") AND
([Completed] = True)")


If you really want the trouble of maintaing a stored value, use DMax() in
the AfterUpdate and AfterDelConfirm events of the subform to read the value
directly from the subform's table, and if different write the result to the
text box on the Parent form and set its Dirty property to False to save it.
Remember to do that after executing any append/delete/update query, and
don't let anyone alter values directly in the table or query.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Metal Goggles said:
I would like to know how to export data entered on a form to a different
table than what it is based on. Here is what I am trying to do. I have
Table A (Orders) and Table B (Orders Received). For each table I have a
form
to populate each table. On Table A (Orders) I have a Field
(DateLastPieceShipped) and (Completed check box). My Form B (Orders
Received) is where I need to enter the data. I need this data be inserted
into my Table A (Orders). Is this possible and how would I go about doing
it. Does this have to be coded in VBA?

Any help would be appreciated.
 
Top