LISTING 1: A Model Declaration and Procedure for Creating a SQL Server Object in the VBA Project Associated with an Access Project Public srv1 As SQLDMO.SQLServer 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