Solved

Visual Basic/Access Project - Runtime Error 3001

Posted on 2003-11-05
5
3,071 Views
Last Modified: 2012-06-27
I am having a problem. I have used this bit of code plenty of times but I am now getting the infamous "runtime error 30001". What I am trying to do is take some text in a .csv file and load it into an access database. There are tons of "fields" in the csv file but I only need the data from two. My Access database has three columns: ID (AutoGenerated Number), Vendor (text 255 characters), and Vendor_Vname (text 255 characters). I am trying to add the records via an ado data object (Adodc1). My plan was to loop through the .csv file and at each value update the Access database. Here's what I have now:

Private Sub Form_Load()
   
    Dim i As Integer
    Dim j As Integer
    Dim a As String
   
    i = FreeFile
   
    Open "j:\idp_netaspx\IDP DOWNLOAD\EXPVEN.csv" For Input As #i
    j = 0
    Line Input #i, a

    While Not EOF(i)
        Input #i, a
        Adodc1.ConnectionString = "Provider=Microsoft.jet.oledb.3.51; Data Source=o:\idp_download\old_lawson_clone.mdb"
        Adodc1.CommandType = adCmdTable
        Adodc1.RecordSource = "lawson_apvenmast"
        Adodc1.Refresh
        Adodc1.Recordset.AddNew
        Adodc1.Recordset("Vendor") = a
        Adodc1.Recordset.Update ("Vendor")
        j = j + 1
    Wend
   
End Sub

If anyone has any questions feel free to ask.
0
Comment
Question by:roman411
[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
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:lttia1
ID: 9691410
Runtime error '3001':
The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.

Since you have used the code plenty of times, so i assume the application is running fine until recently.

Could there be embedded apostrophe in the data that you have retrieved?
eg. La corne d'abondance  
If this is the case, you can solve it by double the embedded apostrophe in the data.
0
 

Author Comment

by:roman411
ID: 9694390
Actually, I am reusing old code in a new program. The old code works for another program doing the exact same operations.

I checked the data and no apostrophies. I checked by hand just now.
0
 
LVL 27

Accepted Solution

by:
Zberteoc earned 125 total points
ID: 9696049
I don't think that Adodc1.Recordset.Update ("Vendor") needs an argument. A recordset is updated by the whole record and not only by one field, ("Vendor") in this case. Try simply:  Adodc1.Recordset.Update
0
 

Author Comment

by:roman411
ID: 9696493
It's funny you know. I have always used Adodc1.Recordset.Update ("Vendor")  and not Adodc1.Recordset.Update and it has always worked for me. Guess what? Kudos to you. And points as well. Thanks.
0
 
LVL 27

Expert Comment

by:Zberteoc
ID: 9697583
Thanks and I'm glad I could help. These are my fisrst points earned on EE. Goodluck in your work.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an explanation of a simple data model to help parse a JSON feed
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.

751 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