Solved

error 3001 when opening recordset

Posted on 2004-09-07
9
230 Views
Last Modified: 2010-04-08
Hi, i'm getting an error 3001 - Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
in the line indicated below. Can anyone help please - I'm really fed up with this!  The database in question is Access.

                Dim objADOConn
      Dim objInspector
      Dim rstLight_Audits

      'connect to database
          Set objADOConn = CreateObject("ADODB.Connection")
          objADOConn.Open "DSN=Light_Audit_db"
          
      Set rstLight_Audits = CreateObject("ADODB.Recordset")
      
      rstLight_Audits.Open "Light_Audits", objADOConn, adOpenDynamic, adLockOptimistic, adCmdTable  'Error here.
      
0
Comment
Question by:colinspurs
  • 6
  • 3
9 Comments
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 11998452
Could be that you need an SQL string in your recordset open statement. Something like this perhaps:

rstLight_Audits.Open "SELECT * FROM Light_Audits;", objADOConn, adOpenDynamic, adLockOptimistic, adCmdTable  'Error here.
0
 
LVL 3

Author Comment

by:colinspurs
ID: 12000859
Nope - tried it and got same error (removed adCmdTable also).

0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12000916
Question: What is the name of the table/query that you are trying to connect to?
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12001019
Try it like this (assumes that your table/query name is "Light_Audits"):

rstLight_Audits.Open "SELECT * FROM Light_Audits;", objADOConn, 1, 1
0
 
LVL 15

Accepted Solution

by:
will_scarlet7 earned 200 total points
ID: 12001055
Sorry, that should have been:

rstLight_Audits.Open "SELECT * FROM Light_Audits;", objADOConn, 2, 3
0
 
LVL 3

Author Comment

by:colinspurs
ID: 12004577
table/query name is "Light_Audits" - correct.

This worked.  Then I replaced the SQL with the table name and that also worked, so it must have been the enums.  If I want to use the enums do I need to check a reference somewhere?  If so, how/where?

Thanks alot - points will be yours.

Colin.
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12004682
This page discusses the Open Method for ADO Recordsets and the enums
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthrstopen.asp
0
 
LVL 3

Author Comment

by:colinspurs
ID: 12004745
Thanks again.
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12004792
Glad I could be a help. ThanX for the points!
God bless!

Sam
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question