ProgrammingMSAccess.com

Learn about Developers Group
Join Developers Group
Order SPAM Blocker
Free Stuff
Guest Book
.NET Resources
SQL Server Resources
Favorites
Technical Support
Books & DVDs by Webmaster
Articles, tutorials, & more
FAQs
Product Reviews
Samples
Prior Newsletters
Contact Us
Home
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

connect a sql-dmo sqlserver object to a sql server.  this procedure checks for a out-of-date version of sql-dmo when a version 7 server attempts to connect to a version 2000 server.  this function procedure requires a reference to the sql-dmo object library.

Function connect_to_server(srvname As String) As Boolean
On Error GoTo connect_trap

'Make connection to server
Set srv1 = New SQLDMO.SQLServer
srv1.Connect srvname, "sa", ""
connect_to_server = True

connect_exit:
Exit Function

connect_trap:
'Process errors in attempt to connect to target server
If Err.Number = -2147165949 Then
MsgBox "Your version of SQL-DMO is out of date for the " & _
"server named " & srvname & ". Update your SQL-DMO " & _
"and Enterprise Manager to a more recent version in " & _
"order to connect to the server."
Else
MsgBox "Unanticipated error with error number and " & _
"description of " & Err.Number, Err.Description
End If
connect_to_server = False

End Function

Want to understand  Microsoft Access 2000 so that you can program it to do more tasks like this?  Get Programming Microsoft Access 2000 by Rick Dobson from Microsoft Press.  Learn more about the book by clicking here.

Copyright 2000 CAB, Inc. All rights reserved. Republication or redistribution of CAB, Inc. content, including by framing or similar means, is expressly prohibited without the prior written consent of CAB, Inc. CAB, Inc. shall not be liable for any errors in the content, or for any actions taken in reliance thereon.