473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Import ODBC tables automatically?

Hi all,
I am new to this forum and relatively new to Access.

I have created an Access database and I am importing 13 tables via ODBC every morning. I am importing these tables instead of linking to them b/c if I link to them the queries are VERY SLOW.

Is there a way to automate the import process thru VBA?

Thanks!
Dec 31 '07 #1
7 23925
Minion
108 Expert 100+
Hi all,
I am new to this forum and relatively new to Access.

I have created an Access database and I am importing 13 tables via ODBC every morning. I am importing these tables instead of linking to them b/c if I link to them the queries are VERY SLOW.

Is there a way to automate the import process thru VBA?

Thanks!
Couple questions about your situation:

1. What type of system is hosting your orginal tables (ie. SQL Server, Oracle, etc)?
2. Currently are you using the import wizard or have you written code to the imports for you?
3. Are the imported tables replacing the existing day's table or are you appending the values to the table?

There might be more information that is needed, but I'll know more when the above is answered. And so you're not lefted with more questions than answers I will tell you that there are a couple of methods to do what you want and to automate it down to a press of a button (or a little more). However, I (and those much more skilled than I) will need more information on the situation so that we can provide the best answer for you.

Hope this helps.

- Minion -
Dec 31 '07 #2
Here are the answers:
1. My original tables are in an AS400 system and I have an ODBC to connect to them.
2.Currently I am going to File-Get External Data-Import-Machine Data Source and importing them all at once daily.
3.No, every day I delete the tables and then reimport them.

Thanks for your help.
Alyssa

Couple questions about your situation:

1. What type of system is hosting your orginal tables (ie. SQL Server, Oracle, etc)?
2. Currently are you using the import wizard or have you written code to the imports for you?
3. Are the imported tables replacing the existing day's table or are you appending the values to the table?

There might be more information that is needed, but I'll know more when the above is answered. And so you're not lefted with more questions than answers I will tell you that there are a couple of methods to do what you want and to automate it down to a press of a button (or a little more). However, I (and those much more skilled than I) will need more information on the situation so that we can provide the best answer for you.

Hope this helps.

- Minion -
Dec 31 '07 #3
ADezii
8,834 Expert 8TB
Hi all,
I am new to this forum and relatively new to Access.

I have created an Access database and I am importing 13 tables via ODBC every morning. I am importing these tables instead of linking to them b/c if I link to them the queries are VERY SLOW.

Is there a way to automate the import process thru VBA?

Thanks!
To automate the Import Process through VBA would require code similar to the following (for a 1 Table Import):
Expand|Select|Wrap|Line Numbers
  1. DoCmd.TransferDatabase acImport, "ODBC Database", _
  2. "ODBC;DSN=DataSource1;UID=User2;PWD=www;LANGUAGE=us_english;" _
  3. & "DATABASE=pubs", acTable, "Source Table Name", "Destination Table Name", False, True
  4.  
  1. acImport - Data Transfer Type.
  2. ODBC Database - Specific Database Type.
  3. "ODBC;DSN=Your DSN Name;UID=Your UserID;PWD=Password;LANGUAGE=us_english;" _
    & "DATABASE=Database Name" - Name of Database and qualifiers.
  4. acTable - Type of Object you are Importing.
  5. Source Table Name - Name of the Source Table being Imported.
  6. Destination Table Name - Name of the Destination Table being created.
  7. False - Both the Structure of the Table and its Data are being Imported.
  8. True - The UserID and Password are both stored in the Connection String which prevents repetitive Log-ins each time the Table is accessed.
P.S. - Most Arguments to the TransferDatabase Method are Optional. Reference this Method in the Help Files for specifics, and let us know how you make out.
Jan 1 '08 #4
Thanks. Here is what I have. When I run it I get this error:
Run Time Error 3151
ODBC Connection to 'barry Mfg' failed

I tried doing it manually and was able to.

Thanks, Alyssa

Expand|Select|Wrap|Line Numbers
  1. Function ODBC()
  2.  
  3. DoCmd.TransferDatabase acImport, "ODBC Database", _
  4. "ODBC;DSN=barry Mfg;LANGUAGE=us  _english;" _
  5. & "DATABASE=SalesReportingDatabase", acTable, "QS36F.ARDETAIL", "TEST", False, True
  6.  
  7. End Function
  8.  
Jan 2 '08 #5
jaxjagfan
254 Expert 100+
Hi all,
I am new to this forum and relatively new to Access.

I have created an Access database and I am importing 13 tables via ODBC every morning. I am importing these tables instead of linking to them b/c if I link to them the queries are VERY SLOW.

Is there a way to automate the import process thru VBA?

Thanks!
Your AS400 drivers may require Driver,Provider or other driver specific items in your connection string.

Here's a couple for SQL Server as samples

Standard Security:
"Driver={SQLServer};Server=Your_Server_Name;Databa se=Your_Database_Name;Uid=Your_Username;Pwd=Your_P assword;"

Trusted connection:
"Driver={SQLServer};Server=Your_Server_Name;Databa se=Your_Database_Name;Trusted_Connection=yes;"


If you go back to your original way of linking the AS400 tables but change your process to append vice recreate the tables each time. The MakeTable queries are very slow. Don't delete the tables each day - just clear the data and reload them. You will find this much quicker.

Function getMyData()
'repeat for all data tables
Docmd.RunSQL "DELETE tblData1.* from tblData1;"
Docmd.OpenQuery "qryApdData1
End Function

Play around with your processes and queries - I had a process that run a monthly finance report that took 8 hrs to run (1600 page report). I dropped it to 2 hrs by getting rid of all of the make table queries and breaking up some of the more complex single queries into multiple queries.
Jan 2 '08 #6
ADezii
8,834 Expert 8TB
Thanks. Here is what I have. When I run it I get this error:
Run Time Error 3151
ODBC Connection to 'barry Mfg' failed

I tried doing it manually and was able to.

Thanks, Alyssa

Expand|Select|Wrap|Line Numbers
  1. Function ODBC()
  2.  
  3. DoCmd.TransferDatabase acImport, "ODBC Database", _
  4. "ODBC;DSN=barry Mfg;LANGUAGE=us  _english;" _
  5. & "DATABASE=SalesReportingDatabase", acTable, "QS36F.ARDETAIL", "TEST", False, True
  6.  
  7. End Function
  8.  
  1. The True Argument indicates the UserID and Password are both stored in the Connection String. Is this the case and are they correct?
  2. I'm not sure on this one, but the space in the DSN Name may be causing a problem.
  3. If you can manually make the Connection, then try opening the DSN (*.udl) with Notepad and look at the Connection String Parameters to see what may be missing.
Jan 2 '08 #7
I have tried to run the code but it comes up saying it cannot find the destination table.
I need it to create the tables each time it has run
Mar 10 '16 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
1
by: Arti Potnis | last post by:
Hi, I want to import some tables from Oracle 9i to MS Access 2000. I'm able to import the table structures and data using File->Get External Data->Import . (I don't want to import links)...
0
by: khsieh | last post by:
Is it possible to import aspnet_* tables from the default ASPNETDB.MDF (SQL Express) used by VS2005 to SQL Server 2K? I intend to use database in SQL Server 2K as membership provider but already...
1
by: tezza98 | last post by:
I need some help. Im using a dtsrun command to import 9 tables into an Access database, most of the tables have about 1000 rows, but one has 20000+ rows and grows everyday. Im Using Access 2003...
0
by: jrhowcroft | last post by:
I have a number of databases in MS Access 97. Some tables in these databases are linked to ODBC tables in Oracle9/10. We would like to change the user name and password on the Oracle tables so each...
10
by: Richard | last post by:
Hi folks, thanks for taking the time to read this (and hopefully point our where I'm going wrong). The scenario: I have a local Access2007 database which links in several read only mySql...
4
by: sethington | last post by:
Here is my situation. I have ODBC Rights to a SQL database but I have 4 users who need to get to this information but because they are contractors they are not allowed to get there own ODBC access. ...
81
MMcCarthy
by: MMcCarthy | last post by:
Hi everyone I am using this as a test question to test the new Rate up/down feature for threads and posts. For anyone looking for a legitimate answer to this question please check out this...
2
by: neelsbr | last post by:
hi, i have export one table from sql server.and those data are import to mysql automatically.no manual.it runs every time gap. please any one know how to do it..help i want to finish this work...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.