?
Solved

Access Data Import using SQL from another Database Table

Posted on 2013-12-10
5
Medium Priority
?
693 Views
Last Modified: 2013-12-12
I'm importing data into Access on a daily basis.  The data in one of the tables ("InvoiceLine") is too big.

The command I use to import the table (by macro) is:
DoCmd.TransferDatabase acImport, "ODBC", ODBCConnectStr, acTable, "InvoiceLine", "InvoiceLine", False

Open in new window


This grabs/imports all 270,000 rows from the source database table.  This causes the Access database to balloon to over 2.0gb and I end up having issues compacting.  Additionally, there are sometimes issues during the import.

I'm wondering if it would be possible to run a similar command with a Query attached so that only transactions with a (date > (today - 180 days)) - or do I have to import everything and then trim the database?

Thanks for your help!
0
Comment
Question by:slightlyoff
[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
  • 2
  • 2
5 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 1000 total points
ID: 39709132
The first way I could see to do it would be to create a named view on the source database that would filter to the rows you want.  Then instead of the table name, you would specify the name of that view.

http://msdn.microsoft.com/en-us/library/office/ff196455.aspx

Now, since I know from the previous question that your source DB is Quickbooks ... I really doubt creating that view is possible.

I would have a look at the Linked Table option at http://support.flexquarters.com/esupport/index.php?/Default/Knowledgebase/Article/View/2471/57/using-quickbooks-data-with-access-2013import-tables-32-bit

You could then load your real Access table (if you even need to) using a SQL Statement that included a WHERE clause.
0
 
LVL 1

Author Comment

by:slightlyoff
ID: 39709248
Thanks for the quick reply!  I forgot to mention the source database was QuickBooks, thanks for mentioning that.

So in other words, create a Linked Access Table, then using something like an append query grab just the data I want into a different table?
0
 
LVL 32

Expert Comment

by:Daniel Wilson
ID: 39709925
So in other words, create a Linked Access Table, then using something like an append query grab just the data I want into a different table?

That's what I would try.  I haven't done it ... but ... it seems more promising than some of the alternatives.
0
 
LVL 38

Assisted Solution

by:PatHartman
PatHartman earned 1000 total points
ID: 39711282
That is the answer I suggested in your other thread.
0
 
LVL 1

Author Comment

by:slightlyoff
ID: 39714926
Sorry Pat, I misunderstood your answer.  Creating a local SQL Server Express database seemed to be more complicated than I needed it to be - so I wondered if it could be done all within Access without a linked table.

The reason I didn't want to link the table is I didn't want any risk of changing the source database (quickbooks).

Thank you both for your help - I'm going to give that a try.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses

762 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