PC Review


Reply
Thread Tools Rate Thread

Access 2003 and SQL Server 2005 and DAO recordset

 
 
stefania nj
Guest
Posts: n/a
 
      19th Oct 2010
Hi,
I have migrated my access tables to SQL Server 2005.
I linked the tables to use with my front-end via ODBC.
I am having serious issues with DAO recordsets

I previously worked with MySQL linked tables and did not experience
this issue.

the test code is the following
Public Function testRec()
Dim rst As DAO.Recordset
Dim sql As String

sql = "SELECT * FROM TBL_ADM_COMPANIES;"
Set rst = CurrentDb.OpenRecordset(sql)
Debug.Print rst.GetRows
rst.Close
End Function

I get run time error 3622
"You must use the dbSeeChanges option with OpenRecordset when
accessing a SQL Server table that has an IDENTITY column"

I added the dbSeeChanges option and run the following code
Public Function testRec()
Dim rst As DAO.Recordset
Dim sql As String

sql = "SELECT * FROM TBL_ADM_COMPANIES;"
Set rst = CurrentDb.OpenRecordset(sql, dbSeeChanges)
Debug.Print rst.GetRows
rst.Close
End Function

I get the following run time error
3001
invalid argument

this code runs correctly
Public Function testRecADO()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sql As String

Set cnn = CurrentProject.Connection
sql = "SELECT * FROM TBL_ADM_COMPANIES"
rst.Open sql, cnn, adOpenStatic

Debug.Print rst.GetString
rst.Close
End Function

But I did not expect to having to change all DAO to ADODB connection I
did not have to do that with MySQL.
Please help.

Thank you in advance,

Stefania
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      19th Oct 2010
On Tue, 19 Oct 2010 06:31:19 -0700 (PDT), stefania nj <(E-Mail Removed)>
wrote:

>Hi,
>I have migrated my access tables to SQL Server 2005.
>I linked the tables to use with my front-end via ODBC.
>I am having serious issues with DAO recordsets


> Set rst = CurrentDb.OpenRecordset(sql, dbSeeChanges)


Try

Set rst = CurrentDb.OpenRecordset sql, dbOpenDynaset, dbSeeChanges

There are multiple arguments to the OpenRecordset method. The order in which
they are provided makes a difference!
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also http://www.utteraccess.com
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using access 2003 adp with sql server 2005 Norman Yuan Microsoft Access ADP SQL Server 3 24th Jun 2007 06:23 AM
Access 2003 and SQL Server 2005 =?Utf-8?B?cmJyb2FkYmVudA==?= Microsoft Access ADP SQL Server 3 16th Nov 2006 10:40 AM
how can access webService design in visual web developer 2005 as we access from iis server in days of VS 2003 kamig Microsoft ASP .NET 1 17th Mar 2006 10:05 PM
Access 2003 & SQL Server 2005 Neil Microsoft Access 4 30th Jan 2006 04:46 AM
Access 2003 and SQL Server 2005 =?Utf-8?B?QWxqb3Nh?= Microsoft Access 6 2nd Jul 2005 01:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:36 PM.