Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
always recheck data connection library for latest connection strin | Excel Discussion (Misc queries) | |||
no DDE connection?? | Excel Discussion (Misc queries) | |||
ADO Connection | Excel Programming | |||
ADO Connection Help | Excel Programming | |||
Connection using ADO | Excel Programming |