Solved

Access Data Import using SQL from another Database Table

Posted on 2013-12-10
5
634 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
  • 2
  • 2
5 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 250 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 36

Assisted Solution

by:PatHartman
PatHartman earned 250 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

821 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