SQL Server 2005 connection string in VBA code in Access

  • I am trying to connect to a database on a SQL Server 2005 server.  The connection string below works on a SQL2000 server, but I get the following condition after the rsobj.open statement ...

    Connection string = "Provider=sqloledb;Data Source='server name here';Initial Catalog='database name here';Integrated Security=SSPI;"

    Error condition for a given expected return field (objRecordset("ProjID")) = "Item cannot be found in the collection corresponding to the requested name or ordinal"

    A given property on the recordset object states that the "operation is not allowed when the object is closed" ... which indicates to me that although I processed an open statement, the object never opened because of an incorrect/invalid connection connection string.

    Any assistance would be greatly appreciated.

    "Double-B"

  • Try changing the provider to SQLNCLI.  See http://www.connectionstrings.com for lots of connection string examples.

    Aunt Kathi Data Platform MVP
    Author of Expert T-SQL Window Functions
    Simple-Talk Editor

  • Kathi ...

    Absolutely awesome!  Thank you very much.  I knew it was a problem with the connection string but couldn't determine exactly what it was.

    Appreciate the help!  Take a coffee break today on me!

    Double-B

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply