Solved

error 3001 when opening recordset

Posted on 2004-09-07
9
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

615 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