473,699 Members | 2,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Import ODBC tables automatically?

3 New Member
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 23999
Minion
108 Recognized Expert New Member
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
abrown728
3 New Member
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 Recognized Expert Expert
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=Y our DSN Name;UID=Your UserID;PWD=Pass word;LANGUAGE=u s_english;" _
    & "DATABASE=Datab ase 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 TransferDatabas e Method are Optional. Reference this Method in the Help Files for specifics, and let us know how you make out.
Jan 1 '08 #4
abrown728
3 New Member
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 Recognized Expert Contributor
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={SQLSer ver};Server=You r_Server_Name;D atabase=Your_Da tabase_Name;Uid =Your_Username; Pwd=Your_Passwo rd;"

Trusted connection:
"Driver={SQLSer ver};Server=You r_Server_Name;D atabase=Your_Da tabase_Name;Tru sted_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 "qryApdData 1
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 Recognized Expert Expert
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
jandi01
1 New Member
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
6771
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 the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
1
2968
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) However, this does not allow me to import constraints and relationships between tables. Is there some way to do so. If not through a menu or utility, is it possible to write code for this activity.
0
938
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 have data in ASPNETDB.MDF, can I import the existing data to SQL Server 2K? Any help will be greatly appreciated.
1
2793
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 and SQL Server 2000. on a WinXP Machine When the database is opened a stored procedure drops all the tables and then imports the csv files using dtsrun. The database is only used for reporting and the data is entered into the csv files using 3rd...
0
2259
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 database in MS Access linking to the tables in Oracle will need to be relinked with the new credentials. We would also like to automate this process of dropping the old links and making a new one through a module that can be run in every database....
10
4441
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 tables via ODBC. The problem:
4
10701
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. So I wanted to create an Access Database using Linking Tables and then Create Local Tables from the Linking Tables. Then they would have a front end view to my newly created tables. Does anyone know how to do this where the data will...
81
6380
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 insight. Now anyone can post a reply here either commenting on the answer or anything else (withing site rules) and others can use the new up/down feature. Please feel free to post as many comments as you wish so we can thoroughly check out this...
2
2882
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 by this week Thanks in advance
0
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9192
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9054
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8940
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8895
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7781
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3071
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.