SQL Server Run-Time Error in MSDE Release A installed in Windows X

S

SHC

Hi all,
I downloaded and installed Microsoft SQL Server 2000 Desktop Engine (MSDE
2000) Release A to the C:\ Drive of my Windows XP Pro PC that is built on
Microsoft NT 4 LAN System. I used Access 2003 VBA program to execute the
attached code. I got a Run-Time error '2147467259(80004005):
[DBNETLIB][ConnectionOpen(Connect()).] SQL Server does not exist or access
denied.
|End| |Debug| |Help|
I clicked on |Debug| and "cnn1.Open str1" was highted in yellow. Please
help and tell me what is wrong in my coding and how to correct the problem.
Thanks in advance,
SHC
//////////////////////////////
Sub OpenMySQLDB()
Dim cnn1 As Connection
Dim rst1 As Recordset
Dim str1 As String
'Create a Connection object after instantiating it,
'this time to a SQL Server database.
Set cnn1 = New ADODB.Connection
str1 = "Provider=SQLOLEDB;Data Source=CabSony1;" & _
"Initial Catalog=NorthwindCS;User Id=sa;Password=password;"
cnn1.Open str1
'Create recordset reference, and set its properties.
Set rst1 = New ADODB.Recordset
rst1.CursorType = adOpenKeyset
rst1.LockType = adLockOptimistic
'Open recordset, and print a test record.
rst1.Open "Customers", cnn1
Debug.Print rst1.Fields(0).Value, rst1.Fields(1).Value
'Clean up objects.
rst1.Close
cnn1.Close
Set rst1 = Nothing
Set cnn1 = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top