LISTING 2: Procedures to Add a User to the Northwind Database on the Cablat Server Sub call_add_user() Dim user_name As String Dim login_name As String 'Set user name and associated login name, 'if appropriate. user_name = "cabxli" If user_name = "guest" Then add_user user_name Else login_name = user_name add_user user_name, login_name End If End Sub Sub add_user(user_name As String, _ Optional login_name As String) Dim srv1 As SQLDMO.SQLServer Dim usr1 As SQLDMO.User 'Instantiate SQLServer object and 'point it at the cablat server. Set srv1 = New SQLDMO.SQLServer srv1.Connect "cablat", "sa", "" 'Instantiate the new User and assign its 'Name and Login properties. Set usr1 = New SQLDMO.User usr1.Name = user_name usr1.Login = login_name 'After creating the user, add it to the 'Users collection for the Northwind database. srv1.Databases("Northwind").Users.Add usr1 'Clean up. Set usr1 = Nothing srv1.Disconnect Set srv1 = Nothing End Sub