0

I'm trying to import a table from access database to other access database. But I don't want to import exactly, I have diferents fields

Courses Table 1

------------------------------
id | name | cost | other_field
------------------------------
1  | C012 | 250  | data

Courses Table 2

------------------------------
id | name | cost  
------------------------------
1  | C012 | 250  

I have all data into Courses 1 and I want to import this table to another table, but just some fields.

Can you help me? Thanks.

0

1 Answer 1

2

Link to Table1 in OtherAccessDb:

DoCmd.TransferDatabase acLink, "Microsoft Access", "C\:Path\OtherAccessDb.accdb", acTable, "Table1", Table1

Now Pass the data. If you have created Table2, Use SQL statement to insert to it data from Table1:

DoCmd.Execuet "INSERT INTO Table2 (id, name, cost) SELECT id, name, cost FROM Table1"

If you have not created Table2, Use SQL statement to create it, insert to it data from Table1:

DoCmd.Execuet "SELECT INTO Table2 id, name, cost FROM Table1

If you don't need the link to Table1 for other use, it is recommended you remove it:

CurrentDb.TableDefs.Delete "Table1"

Note: this answer displays the process using VBA code. If it is a one time job, you can create a link, and a SQL query using the Access ribbon.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.