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!

CurrentDb.OpenRecordset - Error 3001/3622 1

Status
Not open for further replies.

lasombra

Programmer
Mar 22, 2002
26
0
0
CH
Hello, I'm a VB newbie.

My Problem
I have a acces DB with linked tables to a SQL-Server. Now I try to open a linked table in a VB-Modul within Access like follow

...
Dim recset As New ADODB.Recordset

Set recset = CurrentDb.OpenRecordset("tablexy", dbOpenDynaset, dbSeeChanges);
...

This Returns an "Error 3001 - Ivalid Argument"


Whe I try it like this:

...
Dim recset As New ADODB.Recordset

Set recset = CurrentDb.OpenRecordset("tablexy", , dbSeeChanges);
...

I get an "Error 3622 - You must use a dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an ID column"

Why can't I get the Recordset?
 
I wasn't aware you could use CurrentDb with an ADODB recordset. I normally use CurrentDb with DAO.

ADO uses the Connection object to get at the table:

Code:
Sub OpenADODB()
  
Dim rst As New ADODB.Recordset
  
  With rst
    .ActiveConnection = CurrentProject.Connection
    .CursorType = adOpenKeyset
    .Source = "Customers"
    .LockType = adLockPessimistic
    .Open
    .MoveLast
    
    Debug.Print .RecordCount
    
  End With
End Sub
VBSlammer
redinvader3walking.gif
 
Thanks VBSlammer it seems that it works!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top