Solved

Visual Basic/Access Project - Runtime Error 3001

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now