INSERT INTO Table from another access table

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi, "INSERT INTO Table from another access table" - Is it possible to select all into this databse table from another database table?

I show something like this...but wont work [dont know how to make it work...]
Code:
[/FONT]
[FONT=Courier New]Sub Test1()
Dim SQL As String[/FONT]
[FONT=Courier New]SQL = "INSERT INTO ACCESSTBi ( NAMES )" & " " & "IN 'E:\Access\Database4.accdb' "
SQL = SQL & "SELECT ACCESSTBi.NAMES "
SQL = SQL & " FROM ACCESSTB;"[/FONT]
[FONT=Courier New]CurrentDb.Execute SQL[/FONT]
[FONT=Courier New]End Sub


Thanks in advance for helping.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Pedie

What do you mean by 'select all' and how does the code you posted not work?

By the way, are the tables actually in different databases?

If they are then why not just import/link the table the data is coming from?

Then you could do this manually.
 
Upvote 0

What do you mean by 'select all' and how does the code you posted not work?

By the way, are the tables actually in different databases?

If they are then why not just import/link the table the data is coming from?

Then you could do this manually.


Norie, thanks for quick response. For some reason i want to select all data into my table in frontend. Linking data will lead to some problem like data reaching some users who are not suppose to see it etc...So i want to select all when open and delete all when form is unloaded.


 
Upvote 0
Pedie

How is it possible for data to reach someone it shouldn't?

Don't you have any restrictions setup on who can access data?

Also, what's the difference between using code to get all the data and creating a link, which would also involve all the data?
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,894
Members
452,948
Latest member
Dupuhini

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