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

I have developed an Excel report using ADO database connection - thanks to
the help from you good folks on this forum - but most of my users are remote,
travelling to client sites - wondering if there is a way I can test for a
conneciton to the network/datasource and initiate a VPN connection if
required.

Any suggestions?

Thanks,

Jim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default VPN Connection

I test my connection with the following code... Note that m_cDSN, LOGIN_NAME
and LOGIN_PASSWORD are global variables...

Public Function TestConnection() As Boolean
Dim cn As ADODB.Connection

TestConnection = True
Set cn = New ADODB.Connection
On Error GoTo Errorhandler
cn.Open "DSN=" & m_cDSN & ";Uid=" & LOGIN_NAME & ";Pwd=" &
LOGIN_PASSWORD & ";"
cn.Close
Set cn = Nothing
Exit Function
Errorhandler:
TestConnection = False
Set cn = Nothing
End Function

You use it like this...

if TestConnection = false then
msgbox "Connect to VPN and try again"
else
'run the query
end if
--
HTH...

Jim Thomlinson


"JimBob" wrote:

I have developed an Excel report using ADO database connection - thanks to
the help from you good folks on this forum - but most of my users are remote,
travelling to client sites - wondering if there is a way I can test for a
conneciton to the network/datasource and initiate a VPN connection if
required.

Any suggestions?

Thanks,

Jim

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
always recheck data connection library for latest connection strin FurmanGG Excel Discussion (Misc queries) 0 September 14th 07 04:48 PM
no DDE connection?? askmiller Excel Discussion (Misc queries) 0 August 5th 06 09:19 PM
ADO Connection Alex Excel Programming 12 May 5th 06 07:26 PM
ADO Connection Help Matty G Excel Programming 3 June 23rd 05 02:14 PM
Connection using ADO alvin Excel Programming 5 April 5th 05 07:58 AM


All times are GMT +1. The time now is 10:16 PM.

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"