openRecordset error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amindi
    New Member
    • Aug 2006
    • 2

    #1

    openRecordset error

    Hi,
    In my VB program ,the run time error '3001' occurs when I try to execute the openRecordset statement.

    Set rsCustomers = db.OpenRecordse t("Customers" )

    Here, "db" is the connection. "Customers" is the table name. "rsCustomer s" is the recordset.

    The error message is like this,
    "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another".

    How can I correct this error?
    Can anyone please help me....? I would realy appreciate any kind of help....

    Thanks.
    amindi.
  • Tweek
    New Member
    • Feb 2007
    • 17

    #2
    Hi amindi,

    What version of VB are you using? VB6.0, VB.NET, Access (VBA)?

    being a new guy myself anything i say will probably be wrong :P

    try doing a search on this site for "open database vb dao" and "open database vb ado" for some exaples of how to open a database.

    this is how i've been opening mine (using ADO method)...

    Code:
    Dim cnn As ADODB.Connection
    Dim rs As New ADODB.Recordset
    
    Set cnn = CurrentProject.Connection
    
    rs.Open "SELECT * FROM Customers", cnn, adOpenKeyset, adLockOptimistic
    "Set cnn = CurrentProject. Connection" only works from within Access, otherwise you have to do some thing like...

    Code:
    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               "Data Source=c:\somepath\myDb.mdb;"
    to open a connection


    Not a perfect anwser i know but it'll give ya something to think about til someone who knows what they're talking about can help ya :)

    tell us how ya go


    Tweek

    Comment

    • Esmael
      New Member
      • Feb 2007
      • 58

      #3
      Hi... Pls check also your reference... because base from your code... you must be using DAO connection...

      Reference DAO 3.51/3.6
      Sample Declaration of DAO:
      Dim db As DAO.Database
      Dim rsRecordset As DAO.Recordset


      If you still dont get my idea... feel free to asked me more...


      Esmael

      Comment

      Working...