Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3082
  • Last Modified:

Visual Basic/Access Project - Runtime Error 3001

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
roman411
Asked:
roman411
  • 2
  • 2
1 Solution
 
lttia1Commented:
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
 
roman411Author Commented:
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
 
ZberteocCommented:
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
 
roman411Author Commented:
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
 
ZberteocCommented:
Thanks and I'm glad I could help. These are my fisrst points earned on EE. Goodluck in your work.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now