Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default ODBC question

Hi,
I want to know if it is possible to configure an ODBC connection with all
the required parameters including user name and password and use it from
where it is stored on the drive.
Any comments would be appreciated.
Thanks.
--
Jac Tremblay
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default ODBC question

On Jan 13, 6:32*pm, Jac Tremblay wrote:
Hi,
I want to know if it is possible to configure an ODBC connection with all
the required parameters including user name and password


yes, absolutely. I use a lot of pivot tables that are based on ODBC
connections. When you create the PT you can tell Excel to save the
password - then when you refresh, it just goes out and does it.

I also have a lot of PTs that I inherited from a predessor - I have to
form with a few buttons and a text box. One button reads the
connection string

Private Sub cmdGetString_Click()
' Show source Query
Dim pt As PivotTable, sMsg As String
On Error GoTo err_Handler

Set pt = ActiveCell.PivotTable
sMsg = pt.PivotCache.Connection

txtCmdTxt.Value = sMsg
Exit Sub

Another lets you reset it:

Private Sub cmdSetString_Click()
'Set the connection string to the value of the text box
Dim pt As PivotTable
On Error Resume Next

If msgbox("Update connection string to list", vbOKCancel, "Confirm
update") = vbOK Then
Set pt = ActiveCell.PivotTable

pt.PivotCache.CommandText = Me.txtCmdTxt.Value
pt.RefreshTable
End If
End Sub

It's pretty crude code, but it works. Hope that gives you an idea

and use it from
where it is stored on the drive.



I don't quite understand that question, sorry.

hth,

Tim
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default ODBC question

Hi Timmg,
Do you know where this connection object is stored on your hard drive or
what its name is? I do not.
For example, the datetime picker control that one may use on a form is
stored in the C:\Windows\System32\ and is called mscomct2.ocx.
Can someone change that control (set its parameters) and save it under
another name? I do not think so.
That is the same with a connection object, I guess. It cannot be configured
and stored under a different name to be used after by some other procedure.
This question was raised in some discussion where I work and I wanted some
confirmation (is it possible or not?). A simple reasoning gave me the answer.
You helped me with your comment.
So afaik, this closes the case.
Thank you for your answer and have a nice day.
--
Jac Tremblay


"timmg" wrote:

On Jan 13, 6:32 pm, Jac Tremblay wrote:
Hi,
I want to know if it is possible to configure an ODBC connection with all
the required parameters including user name and password


yes, absolutely. I use a lot of pivot tables that are based on ODBC
connections. When you create the PT you can tell Excel to save the
password - then when you refresh, it just goes out and does it.

I also have a lot of PTs that I inherited from a predessor - I have to
form with a few buttons and a text box. One button reads the
connection string

Private Sub cmdGetString_Click()
' Show source Query
Dim pt As PivotTable, sMsg As String
On Error GoTo err_Handler

Set pt = ActiveCell.PivotTable
sMsg = pt.PivotCache.Connection

txtCmdTxt.Value = sMsg
Exit Sub

Another lets you reset it:

Private Sub cmdSetString_Click()
'Set the connection string to the value of the text box
Dim pt As PivotTable
On Error Resume Next

If msgbox("Update connection string to list", vbOKCancel, "Confirm
update") = vbOK Then
Set pt = ActiveCell.PivotTable

pt.PivotCache.CommandText = Me.txtCmdTxt.Value
pt.RefreshTable
End If
End Sub

It's pretty crude code, but it works. Hope that gives you an idea

and use it from
where it is stored on the drive.



I don't quite understand that question, sorry.

hth,

Tim

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
Complicated ODBC data refresh question. JDNETTC Excel Discussion (Misc queries) 6 January 30th 08 11:36 PM
ADO vs ODBC question David Wessell Excel Programming 3 May 3rd 07 04:02 PM
ODBC connection question matelot Excel Programming 1 September 23rd 06 08:46 PM
ODBC question Jim[_36_] Excel Programming 1 January 21st 04 07:20 PM
An ODBC question dchow Excel Programming 0 July 8th 03 11:46 PM


All times are GMT +1. The time now is 11:01 PM.

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

About Us

"It's about Microsoft Excel"