If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > ODBC Connection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-25-04, 16:33
sfisher sfisher is offline
Registered User
 
Join Date: Mar 2004
Posts: 1
ODBC Connection

Hi All,

I have an issue here...I have 9 reports/5 tabs each that I have to run
each week... In order to save myself a bunch of work I have created an ODBC connection to our SQL server database and am using Microsoft Query to get data and putting it into already formatted pivot tables. I have it set to refresh on open. The problem is I need to turn this function off, because I do not want the client to hit the refresh button, because if they do, an error pops up, and then a SQL Server login box pops up with our IP address to the database and the username. I would like to be able to open these reports on my end, refresh the data, save WITHOUT the connection and e-mail to the client. I have been trying for a few hours to figure this out....

Any thoughts?
Reply With Quote
  #2 (permalink)  
Old 03-26-04, 04:59
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
Re: ODBC Connection

I have an idea

try changing this to suit your needs

Code:
Private Sub Workbook_Open()
If Environ("Username") = "dcoutts" Then
    Worksheets(1).PivotTables(1).PivotCache.RefreshOnFileOpen = True
End If
End Sub
this searches for my username and runs the code if this is the case
You can put it in the Workbook open Event.
A draw back will be that your users will be asked if they wan't to enable macros or not.

Hope this helps

David
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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