Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting started with a Server.

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi Guys,
I have just installed SQL server and I'm trying to work out how to connect an access frontend to tables in my server (MS Sql Server 2000). I found this code that should connect the customers form of Northwind and the tables in the Server but I am getting an error message saying:

Run-time error '2147467259 (800004005)':
[DBNETLIB}{ConnectionOpen (ParseConnectParams()).]Invalid connection.

this is the code I got from the microsoft site except for the path to the server that I put in:

Private Sub Form_Open(Cancel As Integer)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset

'Create a new ADO Connection object
Set cn = New ADODB.Connection

'Use the Access 10 and SQL Server OLEDB providers to
'open the Connection
'You will need to replace MySQLServer with the name
'of a valid SQL Server
With cn
.Provider = "Microsoft.Access.OLEDB.10.0"
.Properties("Data Provider").Value = "SQLOLEDB"
.Properties("Data Source").Value = "C:\Program Files\Microsoft SQL Server"
.Properties("User ID").Value = "sa"
.Properties("Password").Value = ""
.Properties("Initial Catalog").Value = "NorthwindCS"
.Open
End With

'Create an instance of the ADO Recordset class, and
'set its properties
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = "SELECT * FROM Customers"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.Open
End With

'Set the form's Recordset property to the ADO recordset
Set Me.Recordset = rs
Set rs = Nothing
Set cn = Nothing
End Sub


Can anyone help me get started with this.
 
I don't use ADO connections, nor do I work with Access....but...

1. I don't see the name of a valid SQL Server instance.
2. you are connecting using the SA login and a blank password. Are you sure the SA login's password is blank? (And if it is...that's a really bad thing).

You might want to post your query in one of the Access forums on this site.

-SQLBill

Posting advice: FAQ481-4875
 
Ok Bill,
Thanks I will do that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top