Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default share adodb connection in excel

people in asp i can share adodb connection in GLOBAL .asa file

but i dont want to dedscribe adodb connection in each sub procedure

where in excel i can place my adodb connection desciption once onl
????


thank

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default share adodb connection in excel

Marek wrote ...

people in asp i can share adodb connection in GLOBAL .asa file

but i dont want to dedscribe adodb connection in each sub procedure

where in excel i can place my adodb connection desciption once only
????


Dim the connection variable at the top of the code module (General
Declarations) e.g.

Private m_Con As ADODB.Connection

If the connection is required in more than one code module, provide a
Property Get e.g.

Friend Property Get Connection() As ADODB.Connection
Set Connection = m_Con
End Property

Jamie.

--
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default share adodb connection in excel

in my module i want to have variable with connection parameters

for example i want to once describe this variable somewhere in module

cons = "provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=db.mdb;"


and after that i simply want to use this string variable in each sub


maybe i must to use constants

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default share adodb connection in excel

Marek wrote ...

in my module i want to have variable with connection parameters

for example i want to once describe this variable somewhere in module

cons = "provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=db.mdb;"

and after that i simply want to use this string variable in each sub

maybe i must to use constants ?


Sure, that's what I'd do:

Private Const CONN_STRING As String = "" & _
"provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=db.mdb;"

although it's unlikely to be needed by multiple subs e.g. if you have
a property that supplies the ADO Connection object.

Jamie.

--
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
ADODB Connection fi.or.jp.de Excel Worksheet Functions 0 September 9th 09 09:23 PM
Trying to simulate 2 separate users in connection with a Share Wor Matthew S Excel Discussion (Misc queries) 3 August 30th 05 12:21 PM
Trying to simulate 2 separate users in connection with a Share Wor Mike Excel Discussion (Misc queries) 0 August 29th 05 09:56 PM
Virus - importing excel via adodb connection Jim M[_4_] Excel Programming 1 May 15th 04 08:09 AM
ADODB Connection to Access Cindy Excel Programming 1 February 27th 04 11:51 AM


All times are GMT +1. The time now is 01:36 AM.

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"