Solved

Copy data from one subform to another - MS Access

Posted on 2016-10-27
3
88 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 37

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

739 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