473,387 Members | 1,859 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,387 software developers and data experts.

SELECT from ODBC INTO access DB

Seth Schrock
2,965 Expert 2GB
I have a database from which I need to pull data and insert it into a local access table. I have successfully tested creating an ADODB recordset. Now I need to some method to copy the data locally. I really don't want to loop through the recordset and copy the data row by row. I'm using a DSN-less connection, so I'm having to provide credentials when the code runs, so I don't think that a straight-through query would work.

So I guess what I'm wondering is if there is a way to use an SELECT INTO query, possibly utilizing the ADODB connection that I have built.

This particular database is not one that I want to do a lot of testing against as it would cause major problems if it stopped working for any reason.
Nov 16 '18 #1

✓ answered by NeoPa

I may be wrong Seth, but I don't believe there's any way available to take data from within your code and dump it into a table. It's possible to do in Excel using CopyFromRecordset, but I'm not aware of such a thing in Access.

How about a linked table to the ODBC source that requires the user name and password then opening that from code and passing the credentials across invisibly. After that you copy the data in the normal way and then remove the credentials from the linked table. You can experiment with different approaches but as a last resort you could always delete the linked table.

5 1249
NeoPa
32,556 Expert Mod 16PB
I may be wrong Seth, but I don't believe there's any way available to take data from within your code and dump it into a table. It's possible to do in Excel using CopyFromRecordset, but I'm not aware of such a thing in Access.

How about a linked table to the ODBC source that requires the user name and password then opening that from code and passing the credentials across invisibly. After that you copy the data in the normal way and then remove the credentials from the linked table. You can experiment with different approaches but as a last resort you could always delete the linked table.
Nov 17 '18 #2
Seth Schrock
2,965 Expert 2GB
So basically I'm stuck editing connection strings via code to get what I need since I can't hard code the credentials. I guess that isn't so much different than what I was doing.

I could create a pass-through query and then run and INSERT FROM based on that pass-through query once I get it the proper connection string and then remove the connection string once I was done. I have four tables that I'm pulling from, so I would rather not have to connect each one and then disconnect them.

Thanks for the input. At least I have a new direction to try.
Nov 19 '18 #3
Brilstern
208 100+
Have you thought about dumping the remote tables into a spreadsheet then importing back into your local DB programmatically? Might be a little more code, but it bypasses your credential problem, I believe...

-Bril
Nov 19 '18 #4
NeoPa
32,556 Expert Mod 16PB
As Stevan says, at least I think he is, you could use CopyFromRecordset() into an Excel worksheet and link to that from your database. Convoluted but workable for anything up to about a million records.
Nov 20 '18 #5
Brilstern
208 100+
Indeed it is NeoPa. I have done quite a bit of work from excel to access and access to excel. As you stated, not always the most direct method; but it can be much simpler, as temporary content through excel is much easier than access.
Nov 20 '18 #6

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

Similar topics

10
by: callmebill | last post by:
I'm getting my feet wet with making Python talk to MySQL via ODBC. I started on Windows, and it went smoothly enough due to the ODBC stuff that apparently is native to Python at least on windows...
8
by: Dominic Martin | last post by:
Hi, I need to setup an ODBC link over our Internet connection between MS Access (local) and a MySQL server (Remote - the local PC has the MySQL ODBC driver installed). What kind of bandwidth...
8
by: Alfonso Esteban Gonzalez Sencion | last post by:
I am trying to use Access as a front end for extracting information from an Oracle database. I started using linked tables but I am getting a very curious behaviour. When I consult the linked...
1
by: KG Kristinsson | last post by:
I am creating an application that uses DSN connection string to connect to a database (using ado or ole db). I like to allow the user to select already created DSN. I found out how to allow the...
10
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
0
by: | last post by:
I am working with the Microsoft 6 Visual Studio C++ standartd edition I have an ODBC access driver, and I got it to work in a tester program, but I get C++ mangled names when I try to use an MFC...
3
by: ErwinMars | last post by:
I've used DB2 LUW V7 a long time ago. Now i'm back and installed DB2 V8.2.2 PE and CONNPE. The DB2 stuff like CC works fine. I can access the sample db and also select records. Than i've defined...
16
by: network-admin | last post by:
We have Problems with Access query on Oracle 10g Database with ODBC Connection. The Query_1 is such as select * from xtable where ycolumn <"S" Result = ODBC Faild...
5
by: titli | last post by:
Hi guys, I have a .mdb which generates , further some mini .mdbs..Later these generated mini mdbs are provided as input to excel viewer.Till yesterday everything was working fine.. But today after...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.