Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel suddenly closes when a DSN-Less connection to SQLServer fails

Hi,

I'm using a function to retrieve data from SQL Server (2000) with Excel
2003, the connection string I'm using is the following...

On Error Resume Next
Set Connect = CreateObject("ADODB.Connection")

OdbcDSN = "Driver={SQL
Server};SERVER=hostname\name;UID=sa;DATABASE=mydb"

Connect.Open OdbcDSN '--------------- The Excel just closes here!

If Connect.Errors.Count < 0 Then
For Each objError In Connect.Errors
If objError.NativeError < 5701 And objError.NativeError < 5703
Then ' Ignore the success warnings
Connect.Close
GoTo Continue
End If
Next
End If

The problem is that I want to handle if the user can't reach the SQL Server
(for any reason) so the function will continue executing the rest of the
tasks but, when the function tries to open the connection, excel simply
closes, with no error, no warnings... nothing at all.

~Luis

Thanks!


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
Excel - MS sqlserver 2000 connection wannesh Excel Discussion (Misc queries) 0 February 3rd 06 03:10 PM
Macro Suddenly Fails Bill Martin Excel Discussion (Misc queries) 2 September 16th 05 01:55 PM
ADO Connection to ORACLE 9.2 through EXCEL fails Dave Bash Excel Programming 5 November 14th 04 06:32 AM
DTS: SQLServer to Excel in unattended server environment Alberto Cricca Excel Programming 0 September 3rd 04 11:03 AM
Excel Front End , SqlServer Backend in the web [email protected] Excel Programming 0 September 30th 03 05:11 PM


All times are GMT +1. The time now is 08:05 AM.

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"