Solved

Copy data from one subform to another - MS Access

Posted on 2016-10-27
3
112 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 38

Accepted Solution

by:
PatHartman earned 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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 shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

623 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