473,471 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Create 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 23941
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=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
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={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 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
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
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
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,...
1
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
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
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.