CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2002
    Location
    delhi,india
    Posts
    61

    Angry Runtime Error 3001 : The application is using arguments.........

    I want to export data from the Ms-Access database to the excel file thru VB.
    I have written the following code on the click of a button.......

    Open_Connection
    sqlstr = "Select * from report"
    MyRS2.CursorLocation = adUseClient
    MyRS2.Open sqlstr, myconn, adOpenStatic, adLockBatchOptimistic
    MyRS2.MoveFirst

    Public Sub Open_Connection()
    Dim database As String
    database = "autodial"
    Set myconn = New ADODB.Connection
    myconn.ConnectionString Provider=Microsoft.Jet.OLEDB.3.51;Data Source= autodial.mdb;"
    myconn.Open
    End Sub

    now in this code this error is coming "runtime error 3001 : The application is using arguments that are of wrong type, are out of acceptable range, or are in conflict with one another". This error is coming while opening the connection i.e. myrs2.open sqlstr....... statement.

    what is the problem in this code?
    You are what your strong Desire is...
    As your desire is , so is your Will...
    As your will is, so is your Deed...
    As your deed is ,so is your Fate.

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    runtime error 3001 ...

    This usally happens when you're using a provider that does not
    support some operations (like fetching, which in your case,
    is indicated by the "adLockBatchOptimistic")
    You can try:
    a)
    change provider (try jet 4.0)
    or b)
    Open serverside,
    create a NewRs clientside
    Mapp all fields to new rs
    Copy all records
    close first recordset
    return NewRs
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Jan 2003
    Location
    7,107 Islands
    Posts
    2,487
    Watch out for this one.. I think you have missed something..

    myconn.ConnectionString Provider=Microsoft.Jet.OLEDB.3.51;Data Source= autodial.mdb;"


    It must be...

    myconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source= autodial.mdb;"
    Busy

  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Nice, Thread1!

    I completely missed the main thing! Nice you saw it!!
    Strange mistake, however: Vb should not let it pass...

    By the way ascom:
    if you do not attach anything else, skip last ";"
    Last edited by Cimperiali; February 20th, 2004 at 06:24 AM.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured