Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Copy data from one subform to another - MS Access

Posted on 2016-10-27
3
Medium Priority
?
189 Views
Last Modified: 2016-11-04
I have an Access database that has a form with 2 subforms on it.  Subform1's record source is MyTable. Subform2's record source is MyTemporaryTable.   In the detail section of Subform1 (displayed as continuous forms), in addition to the table's fields displayed in textboxes, I have a command button that I intend to use as a "select" button.  the "select" button appears next to every record displayed in Subform1.

I want to be able to 'select' a record from Subform1 and have it copied into Subform2 (i.e. populate the temporary table with that record).

So, my question is related to the action of the 'select' button in Subform1.  How do I get it to copy the selected record from Subform1 and populate Subform2 (and thereby save it to the temporary table)?

If it isn't that complex of a solution, then it would also be great if someone could show me how to also 'deselect' a record from Subform2 (i.e. I would also put a command button in Subform2 like I have in Subform1 except its purpose would be to delete the record from the temporary table in the event the user made a mistake and selected the wrong record from Subform1).

The data needs to be saved to the temporary table as I will be doing something additional with the data in the near future, so I don't want to just populate subform2.  I need the selected data to actually be saved to the temporary table.

Thank you
0
Comment
Question by:dbfromnewjersey
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 41862777
this type of problem needs a working db...
please don't expect the experts to create a sample db to simulate your db.

upload a copy of the db.
0
 

Author Comment

by:dbfromnewjersey
ID: 41862974
I'll upload one shortly
0
 
LVL 40

Accepted Solution

by:
PatHartman earned 2000 total points
ID: 41864144
The copy would be done with a select query.  The select query's WHERE clause references the selected record in sfrm 1 and appends the record to the table of sfrm 2 (probably changing some value rather than copying all the fields.  For example.

Insert Into tbl2(fld1, fld2, fld3)
Select  fld1, fld2, "Newvalue"
From tbl1
Where tbl1.ID = Forms!yourform!yoursubform.Form!IDfield;
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question