Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default MS Query "Connections"

Once you build the query, then yes, you just use the refresh property after
you change the string. The query is automatically dropped.. What you are
talking in the names collection are not connections.

--
Regards,
Tom Ogilvy

"Johnslg" wrote in message
...
hmmm....I'm calling QueryTable inside a For loop in a single VB macro.
The
loop will run for as many cells of data the user adds to a column in the
spread sheet.

I'm doing a Activesheet.QueryTable.Add.....

I'm not sure how to "refresh".

Can I do ...QueryTable.Refresh.... instead of Add?

Is there no "drop connection" command or method?

THANKS!

"Tom Ogilvy" wrote:

http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

once the query is built, change the parameter and refresh the query
(don't
rebuild it). Make the the Backgroundquery property is set to false.

--
Regards,
Tom Ogilvy


"Johnslg" wrote:

I have a sheet that lets the user enter a chart of accounts in a column
&
then a macro runs against each account (using QueryTable), hits an SQL
database, and returns data. My problem is that it adds a new
connection each
time the mcro runs. I just deleted about 400 connections.

Is there a way to reuse the same connection (it's all going against the
same
server/database) or is there a way to automatically delete connetions?

Thanks.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default MS Query "Connections"

Yesterday after debugging the macro, I opend up my "connections" button and
there were like a hundred and eighty connections, connection1 -
connection189. Those are the one's I'm concerned about. I can delete them
but I can't always be certain the user will remember to delete them. I don't
know how many connections Excel will create before it crashes.

All I did was record a macro of connecting to SQL Server and downloading
some data. Excel built the macro actually using QueryList....I changed it to
QueryTable....now it seems I should be using ADO. Sigh.....

Thanks!

"Tom Ogilvy" wrote:

Once you build the query, then yes, you just use the refresh property after
you change the string. The query is automatically dropped.. What you are
talking in the names collection are not connections.

--
Regards,
Tom Ogilvy

"Johnslg" wrote in message
...
hmmm....I'm calling QueryTable inside a For loop in a single VB macro.
The
loop will run for as many cells of data the user adds to a column in the
spread sheet.

I'm doing a Activesheet.QueryTable.Add.....

I'm not sure how to "refresh".

Can I do ...QueryTable.Refresh.... instead of Add?

Is there no "drop connection" command or method?

THANKS!

"Tom Ogilvy" wrote:

http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

once the query is built, change the parameter and refresh the query
(don't
rebuild it). Make the the Backgroundquery property is set to false.

--
Regards,
Tom Ogilvy


"Johnslg" wrote:

I have a sheet that lets the user enter a chart of accounts in a column
&
then a macro runs against each account (using QueryTable), hits an SQL
database, and returns data. My problem is that it adds a new
connection each
time the mcro runs. I just deleted about 400 connections.

Is there a way to reuse the same connection (it's all going against the
same
server/database) or is there a way to automatically delete connetions?

Thanks.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default MS Query "Connections"

Ok, I'll bite. Where is this "connections" button.

--
Regards,
Tom Ogilvy


"Johnslg" wrote:

Yesterday after debugging the macro, I opend up my "connections" button and
there were like a hundred and eighty connections, connection1 -
connection189. Those are the one's I'm concerned about. I can delete them
but I can't always be certain the user will remember to delete them. I don't
know how many connections Excel will create before it crashes.

All I did was record a macro of connecting to SQL Server and downloading
some data. Excel built the macro actually using QueryList....I changed it to
QueryTable....now it seems I should be using ADO. Sigh.....

Thanks!

"Tom Ogilvy" wrote:

Once you build the query, then yes, you just use the refresh property after
you change the string. The query is automatically dropped.. What you are
talking in the names collection are not connections.

--
Regards,
Tom Ogilvy

"Johnslg" wrote in message
...
hmmm....I'm calling QueryTable inside a For loop in a single VB macro.
The
loop will run for as many cells of data the user adds to a column in the
spread sheet.

I'm doing a Activesheet.QueryTable.Add.....

I'm not sure how to "refresh".

Can I do ...QueryTable.Refresh.... instead of Add?

Is there no "drop connection" command or method?

THANKS!

"Tom Ogilvy" wrote:

http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

once the query is built, change the parameter and refresh the query
(don't
rebuild it). Make the the Backgroundquery property is set to false.

--
Regards,
Tom Ogilvy


"Johnslg" wrote:

I have a sheet that lets the user enter a chart of accounts in a column
&
then a macro runs against each account (using QueryTable), hits an SQL
database, and returns data. My problem is that it adds a new
connection each
time the mcro runs. I just deleted about 400 connections.

Is there a way to reuse the same connection (it's all going against the
same
server/database) or is there a way to automatically delete connetions?

Thanks.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default MS Query "Connections"

In the Data ribbon (xl2007 - query table is kind of a POA...it has to be
refreshed and every time it refreshes it creates a new connection)

.....BUT....I switched my code to ADO and (almost) everything is going
fine....thanks to you and Mr. Carey.

I just have one last problem. I want to pop a window and ask the user to
input UID/PWD to connect :

cnnConnect.Open "Provider=SQLOLEDB;SERVER=" & SvrName & ";DATABASE=" &
dbName & ";UID=" & user & ";PWD=" & pass & " "

This fails. If I replace UID/PWD with "trusted_Connection=yes" it logs in.

We use windows authentication, no user accounts in SQL server. Is this
connection string trying to find a SQL Server account????



"Tom Ogilvy" wrote:

Ok, I'll bite. Where is this "connections" button.

--
Regards,
Tom Ogilvy


"Johnslg" wrote:

Yesterday after debugging the macro, I opend up my "connections" button and
there were like a hundred and eighty connections, connection1 -
connection189. Those are the one's I'm concerned about. I can delete them
but I can't always be certain the user will remember to delete them. I don't
know how many connections Excel will create before it crashes.

All I did was record a macro of connecting to SQL Server and downloading
some data. Excel built the macro actually using QueryList....I changed it to
QueryTable....now it seems I should be using ADO. Sigh.....

Thanks!

"Tom Ogilvy" wrote:

Once you build the query, then yes, you just use the refresh property after
you change the string. The query is automatically dropped.. What you are
talking in the names collection are not connections.

--
Regards,
Tom Ogilvy

"Johnslg" wrote in message
...
hmmm....I'm calling QueryTable inside a For loop in a single VB macro.
The
loop will run for as many cells of data the user adds to a column in the
spread sheet.

I'm doing a Activesheet.QueryTable.Add.....

I'm not sure how to "refresh".

Can I do ...QueryTable.Refresh.... instead of Add?

Is there no "drop connection" command or method?

THANKS!

"Tom Ogilvy" wrote:

http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

once the query is built, change the parameter and refresh the query
(don't
rebuild it). Make the the Backgroundquery property is set to false.

--
Regards,
Tom Ogilvy


"Johnslg" wrote:

I have a sheet that lets the user enter a chart of accounts in a column
&
then a macro runs against each account (using QueryTable), hits an SQL
database, and returns data. My problem is that it adds a new
connection each
time the mcro runs. I just deleted about 400 connections.

Is there a way to reuse the same connection (it's all going against the
same
server/database) or is there a way to automatically delete connetions?

Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inhibit use of the function "Connections" on Excel 2007 Andrea Proietti Neri Setting up and Configuration of Excel 0 January 7th 10 06:28 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How to avoid "Data connections have been disabled" [email protected] Excel Discussion (Misc queries) 7 March 19th 08 01:14 PM
"Data Connections have been disabled" If no macros, Why? [email protected] Excel Discussion (Misc queries) 1 October 13th 07 01:26 AM
MS Query "Connections" Don Guillett Excel Programming 1 May 25th 07 01:15 PM


All times are GMT +1. The time now is 12:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"