Results 1 to 9 of 9

Thread: Runtime Error 3251 - HELP!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Austin,TX,USA
    Posts
    98
    Help! I'm trying to dump a CSV textfile into my Access97 database, using ADO. when I get to the rs.AddNew line I get Error 3251! (The operation requested by the application is not supported by the provider) Here's the code:

    Set db = New ADODB.Connection
    Set rs = New ADODB.Recordset

    connectString = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & App.Path & "\TestDB1.mdb;Jet OLEDB:database password=;Mode=Share Deny None"

    ' NOW OPEN DB
    db.Open connectString

    ' NOW the Recordset
    rs.Open "FirstTable", connectString, , , adCmdTable

    ' OPEN THE TEXT FILE
    Open App.Path & TextFileName For Input As #1

    'WRITE TEXT FILE TO VARIABLES
    Do While Not EOF(1)

    Input #1, sFirstField, sSecondField

    ' NOW LOAD THE DB

    rs.AddNew ** HERE'S WHERE THE ERROR POPS UP!!
    rs!FirstField = Trim(sFirstField)
    rs!SecondField = Trim(sSecondField)
    rs.Update

    WHAT am I missing?? I'd appreciate any help! NOTE: the Access DB is a simple 1 table(FirstTable) DB, NOT password protected, if that helps any.


  2. #2
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232
    Maybe you didn't open the recordset correctly:

    Your code:
    rs.Open "FirstTable", connectString, , , adCmdTable

    Try use:
    Set rs = db.OpenRecordset "FirstTable"

    If I'm not mistaken, your syntax opens a disconnected recordset... ?

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    I think, instead of
    rs.Open "FirstTable", connectString, , , adCmdTable

    you have to write:

    ' NOW the Recordset
    rs.Open "FirstTable", db, , , adCmdTable

    And you don't have to put ADO control on a form.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Austin,TX,USA
    Posts
    98

    Thanks, but not yet!

    Thanks for the suggestion LG! I typed in EXACTLY what you said, but I STILL get the same damn error!!! Maybe I need to do it in DAO, but I wanted to avoid that! Well, I'll keep playing with it...

  5. #5
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    Try to add CursorType and LockType before you open recordset.

    rs.CursorType = adOpenKeyset
    rs.LockType = adLockOptimistic
    rs.Open "FirstTable", db, , , adCmdTable



  6. #6
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    I did a quick search of MSDN and found this. Hope it helps.

    PRB: Error 3251 Generated by Calling ADOX Methods
    Article ID: Q201716

    The information in this article applies to:
    ActiveX Data Objects (ADO), version 2.1

    SYMPTOMS
    Executing an ADOX method such as the following:
    Catalog.Tables.Append tbl
    against SQL Server may generate the following error:

    Run time error "3251": "The operation requested by the application is not supported by the provider".

    CAUSE
    SQL Server's Stored Procedures are not current.

    RESOLUTION
    Run the Instcat.sql script that came with the version of Microsoft Data Access Components (MDAC) currently installed.


  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Austin,TX,USA
    Posts
    98

    All right!

    Yes!! LG, your latest worked!! Thanks so much! Out of curiosity, any idea WHY we have to go thru all those permutations to get the sucker to work right?? I thought ADO was supposed to be EASIER to use <g>!

    And Mongo, have you run the script on your system-and did it work? Thanks for all y'alls help!!

  8. #8
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    I don't know why. But I ran at the same problem using AddNew with DAO and found out, that it is a bug.You have to specify all parameters in Openrecordset. So I assumed, that it's the same problem.
    Glad it helped.

  9. #9
    New Member
    Join Date
    May 2005
    Posts
    1

    Exclamation Re: Runtime Error 3251 - HELP!!

    Before

    ...
    rs.Open "FirstTable", db, , , adCmdTable
    ...

    Set your connection location

    ...
    .CursorLocation = adUseClient
    ...

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