Adding record to Another Table

MHamid

Active Member
Joined
Jan 31, 2013
Messages
472
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello,

I was wondering if it is possible to create a macro to paste record from a form (Student ID, using Student ID Table), into a different table (main_data) and delete record?

If so, how is this possible?


Thank you
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Use an append query to copy the data from tbl1 to tbl2, then another query to delete from tbl1, assuming that's what you mean. If you need a macro because this is not a one-time thing, then create the macro to execute those steps. You might want to practice on copies of those tables first.
 
Upvote 0
Hello,

Can you give a example on how to do both options?


Thank you
 
Upvote 0
You want me to tell you how to create an append query and a delete query? Or are you asking about code? You asked for a macro, but I don't do macros so I'm very unfamiliar with them. There's lots of instructions on the web on how to do either of these things and you'd be better off if you found one or more that apply to your situation. Here's what a query sql might look like if I wanted to copy from tblAscii into tblAscii2 where the key values in the 1st table are less than 40

Code:
INSERT INTO tblAscii2 ( [CodeValue], [Character], [Desc] )
SELECT tblAscii.CodeValue, tblAscii.Character, tblAscii.Desc
FROM tblAscii WHERE (((tblAscii.CodeValue)<40));
 
Upvote 0
The MS Access is the well-known database. We can add data from one table to another table by using these query below.
INSERT INTO TABLE2 SELECT * FROM TABLE1
INSERT INTO TABLE2 SELECT * FROM TABLE1 WHERE COL1 = 'X'
These queries will help you so much. I am getting the issue in MS Access because it is not working properly means virus issue. What should I do to resolve this issue? I install Avast antivirus and also try on
avast customer service for the help purpose but did not get any response.



 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top