Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

error 3001 when opening recordset

Posted on 2004-09-07
9
Medium Priority
?
235 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 800 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
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…

730 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