Solved

Visual Basic/Access Project - Runtime Error 3001

Posted on 2003-11-05
5
3,069 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
  • 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 26

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 26

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is Python programming? 3 122
Hide vba in gp 7 104
Customizing meta title for 404 page template in WordPress' TwentySixteen theme 2 93
VB.net and sql server 4 45
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.

829 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