Dim tbl As New ADOX.Table
Dim cn As New ADODB.Connection
Dim cl As New ADOX.Column
Dim cat As New ADOX.Catalog

'Open Connection to Data Source
With cn
.ConnectionString = "PROVIDER=sqloledb;DATA SOURCE=ServerName;USER ID=userID;PASSWORD=Password;INITIAL CATALOG=pubs"
.Open

End With

'Associate the Catalog object to the Connection.
With cat
.ActiveConnection = cn
End With

'Create a table definition.
With tbl
.Name = "MyADOXtbl"
End With

'Create a Column definition.
With cl
.Name = "Col1"
.DefinedSize = 10
.Type = adChar
.Attributes = adColFixed + adColNullable
End With

'Add the Column definition to the table table definition.
tbl.Columns.Append cl

'Create the table on the Data Source
cat.Tables.Append tbl



When Ado is opened it gives the message "SQL SErver dosen't exit or ascess denied"

If I try to connect the SQL Server (MSDE ) using the below code it connects , Where am I wrong in the above code , Please help to connect the local MSDE using the ADODB or ADOX connection

Dim mOSQLServer As SQLDMO.SQLServer
Set mOSQLServer = New SQLDMO.SQLServer

With mOSQLServer
.LoginSecure = True
.AutoReConnect = False
.Connect SERVERNANE,USERID, PASSWORD
End With