Solved

Copy data from one subform to another - MS Access

Posted on 2016-10-27
3
55 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 35

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

803 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