Access 2003: Execute VBA-SQL Server Souce Code of Book's Examples

S

SHC

Hi all,
I have Windows XP Pro PC that is on Microsoft NT 4 LAN System. I have Access
2003/Office 2003 and Microsoft SQL Server 2000 Release A (MSDE 2000)
installed in the Windows XP Pro. I am learning how to do ADO and ASP by doing
the examples of R. Dobson's book "Programming Microsoft Office Access 2003".
I just want to execute the source code of the book examples in the Access
2003 without bothering the Computer Administrator and I have a "default"
instance configured to use Windows Authentication Mode and a "named" instance
configured to Mixed Mode and the least security set up in the Access 2003 VBA
programming. But I do not know what level of security zones I need to
establish to link the VBA and SQL Server (MSDE 2000). I ran the attached code
and I got a Run-Time Error '-2147467259 (800004005)':
[DBNETLIB][ConnectionOpen(Connect())]SQL.Server does not exist or access
denied. Please help and advise me what level of security I should set up and
what SQL Parameters (like Data Source, etc.) I need to fill out to make the
example cose working for me.
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