473,394 Members | 2,063 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,394 software developers and data experts.

Excel DSN Query

Craash
18
I understand this is an access forum so I apologize if this is inappropriate.
I have an excel spreadsheet that I have created a query using a DSN to access a sql database. My question; is there a way to change the DSN without creating a new query?

I have a SQL database that is used as a backend to an accounting application. Currently many upper management users have created spreadsheets to pull reports from this database using the backend (DSN connection). Since this is a production database I have created a script to restore the nightly backup to another server and I have denied access to the production server backend. Now I have many spreadsheets with queries set up to use a DSN connection to the production database. I would like to know if there is a known way or script to change the DSN without creating new queries.

Thanks for any help that you can provide.

Sboivin
Mar 1 '07 #1
3 3380
MMcCarthy
14,534 Expert Mod 8TB
I understand this is an access forum so I apologize if this is inappropriate.
I have an excel spreadsheet that I have created a query using a DSN to access a sql database. My question; is there a way to change the DSN without creating a new query?

I have a SQL database that is used as a backend to an accounting application. Currently many upper management users have created spreadsheets to pull reports from this database using the backend (DSN connection). Since this is a production database I have created a script to restore the nightly backup to another server and I have denied access to the production server backend. Now I have many spreadsheets with queries set up to use a DSN connection to the production database. I would like to know if there is a known way or script to change the DSN without creating new queries.

Thanks for any help that you can provide.

Sboivin
I'm no expert although there are some experts here with knowledge in this area I believe.

At a guess I would say that you would have to find a way to access the query properties to change the DSN connection name.

Mary
Mar 1 '07 #2
Craash
18
I'm no expert although there are some experts here with knowledge in this area I believe.

At a guess I would say that you would have to find a way to access the query properties to change the DSN connection name.

Mary
Hi Mary, thanks for the reply. Microsoft does not make it that easy for us. When you access the query properties it lets you change everything but the DSN connection.

I believe I have figured out a way to do it by using a simple script...
ActiveSheet.QueryTables(1).Connection = "ODBC;DSN=newDSN"
ActiveSheet.QueryTables(1).Refresh

Believe it or not this seems to work...Thanks :)
Mar 1 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Hi Mary, thanks for the reply. Microsoft does not make it that easy for us. When you access the query properties it lets you change everything but the DSN connection.

I believe I have figured out a way to do it by using a simple script...
ActiveSheet.QueryTables(1).Connection = "ODBC;DSN=newDSN"
ActiveSheet.QueryTables(1).Refresh

Believe it or not this seems to work...Thanks :)
Good to know ;)
Mar 1 '07 #4

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

Similar topics

2
by: Fred | last post by:
Hi. How do I import while mapping an excel table to an access table please??? I've searched around and all I can find is a software product or code that does the same thing as the access...
0
by: Mike Knight | last post by:
(I've also posted this problem on microsoft.public.excel.programming) I have a MS Access 2003 Database named "AS400 Fields.mdb". This database contains links to tables on an AS400. In MS...
2
by: aland | last post by:
I've got an Excel spread sheet with one row of id's and I'd like to use these in a query and put the results into Excel. Basically I'd like to do something like SELECT txtFileTitle, txtFileYear...
19
by: wreckingcru | last post by:
I'm trying to output a SQL query that is constructed thru my VB.net GUI into an excel file. Here is the code I'm using: 'Sqlstmt is the SQL query statement 'Conn is the SQL Connection object...
1
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm...
4
by: Belgarath | last post by:
Hello all, I'm a newbie in Access... And before starting to explore this software, I would like to know if it's possible to automate everyday queries result in Excel . If it's possible can...
4
by: torontolancer | last post by:
Hi there how r u .I would really appriciate ur concern regarding checking out this code. its beind a command button and i am have a combo box selecing a query criteria and then pressing the button...
1
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am...
0
NeoPa
by: NeoPa | last post by:
Many of us have noticed that there are some very useful functions available to you when using Excel, but these same functions are not available, as standard, in Access. A particular issue I had...
14
by: fkbodley | last post by:
I am trying to upload a filtered form to excel. Using code someone posted to me I tried to make this work. But like all great code for a newbee.. IT DOSENT WORK! Can some one help me out. Code:...
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: 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
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...
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...

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.