I am having a problem with getting a recordset to fill with data in an
Access Data Project from a SQL Server database.
Here is the code example that is in the Access help files that I can
get to work just fine:
Dim Cnxn As ADODB.Connection
Dim rstEmployees As ADODB.Recordset
Dim strCnxn As String
Dim strSQLEmployees As String
Dim varDate As Variant
' Open connection
strCnxn = "Provider='sqloledb';Data Source='MySqlServer';" & _
"Initial Catalog='Pubs';Integrated Security='SSPI';"
Set Cnxn = New ADODB.Connection
Cnxn.Open strCnxn
' Open employee table
Set rstEmployees = New ADODB.Recordset
strSQLEmployees = "employee"
rstEmployees.Open strSQLEmployees, Cnxn, adOpenKeyset,
adLockOptimistic, adCmdTable
The only thing I changed was the Data Source from "MySqlServer" to the
name of our sql server and and this works and pulls in 43 records as
contained in the pubs database example.
So I changed the Inital catalog from "Pubs" to my database on the same
server and changed the table name from "employee" to my table name on
that server and when I run that, it returns back no records when there
is thousands of records in this table. Even thought it returns back no
records, looking at the object in debug mode shows that is knows the
field names of the table so I know that is it connecting correctly to
the database and the table.
My security in sql server is administrator and thus have access to all
database on this server.
Any ideas why I can connect to the text example and return data and not
my production data?
Thanks in advance.....