Welcome to Dream.In.Code
Become a VB Expert!

Join 149,452 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,146 people online right now. Registration is fast and FREE... Join Now!




Help Needed Saving recorded to database in VB5

 
Reply to this topicStart new topic

Help Needed Saving recorded to database in VB5

SilentCodingOne
20 Jan, 2008 - 09:00 PM
Post #1

D.I.C Head
**

Joined: 8 Nov, 2007
Posts: 63


My Contributions
I'm in the process of taking an existing application that does not work in XP and Vista and updating it to work properly. It has an Access database that stores the data that did not work in XP or Vista as well. I was able to correct everything and get it working. The application is also working except I cannot get the app to save data into the database. I always get an error message that says Run time Error 3265 Item is not in the collection. Below is the code for the save part of the program.

CODE

    ws.Recordset.Fields("vehicle_type") = vehicle_type
    ws.Recordset.Fields("form_type") = form_type
    
    ws.Recordset.Fields("2dr_sedan") = dr2_sedan
    ws.Recordset.Fields("hatchback") = Hatchback
    ws.Recordset.Fields("body_other") = Other

    ws.Recordset.Fields("claim_no") = UCase(Claim_No)
    ws.Recordset.Fields("owner") = UCase(Vehicle_Owner)
    ws.Recordset.Fields("address") = UCase(Address)
    
    ws.Recordset.Fields("vin") = VIN
    ws.Recordset.Fields("control") = Control
    ws.Recordset.Fields("dateprepared") = DatePrepared
    ws.Recordset.Fields("yearmake") = UCase(YearMake)
    
    ws.Recordset.Fields("unibody") = Unibody
    ws.Recordset.Fields("frame_body") = Frame_Body
    ws.Recordset.Fields("original") = Original
    ws.Recordset.Fields("supplemental") = Supplemental
    
    ws.Recordset.Fields("prepared") = Prepared
    
    ws.Recordset.Fields("right_top0") = Right_Top(0)
    ws.Recordset.Fields("right_top1") = Right_Top(1)
    ws.Recordset.Fields("right_top2") = Right_Top(2)
    ws.Recordset.Fields("right_top3") = Right_Top(3)
    ws.Recordset.Fields("right_top4") = Right_Top(4)
    ws.Recordset.Fields("right_top5") = Right_Top(5)
    ws.Recordset.Fields("right_top6") = Right_Top(6)
    ws.Recordset.Fields("right_top7") = Right_Top(7)
    ws.Recordset.Fields("right_top8") = Right_Top(8)
    ws.Recordset.Fields("right_top9") = Right_Top(9)
    ws.Recordset.Fields("right_top10") = Right_Top(10)
    ws.Recordset.Fields("right_top11") = Right_Top(11)
    ws.Recordset.Fields("right_top12") = Right_Top(12)
    ws.Recordset.Fields("right_top13") = Right_Top(13)
    ws.Recordset.Fields("right_top14") = Right_Top(14)
    ws.Recordset.Fields("right_top15") = Right_Top(15)
    ws.Recordset.Fields("right_top16") = Right_Top(16)
    ws.Recordset.Fields("right_top17") = Right_Top(17)
    ws.Recordset.Fields("right_Bottom0") = Right_Bottom(0)
    ws.Recordset.Fields("right_Bottom1") = Right_Bottom(1)
    ws.Recordset.Fields("right_Bottom2") = Right_Bottom(2)
    ws.Recordset.Fields("right_Bottom3") = Right_Bottom(3)
    ws.Recordset.Fields("right_Bottom4") = Right_Bottom(4)
    ws.Recordset.Fields("right_Bottom5") = Right_Bottom(5)
    ws.Recordset.Fields("right_Bottom6") = Right_Bottom(6)
    ws.Recordset.Fields("right_Bottom7") = Right_Bottom(7)
    ws.Recordset.Fields("right_Bottom8") = Right_Bottom(8)
    ws.Recordset.Fields("right_Bottom9") = Right_Bottom(9)
    ws.Recordset.Fields("right_Bottom10") = Right_Bottom(10)
    ws.Recordset.Fields("right_Bottom11") = Right_Bottom(11)
    ws.Recordset.Fields("right_Bottom12") = Right_Bottom(12)
    ws.Recordset.Fields("right_Bottom13") = Right_Bottom(13)
    ws.Recordset.Fields("right_Bottom14") = Right_Bottom(14)
    ws.Recordset.Fields("right_Bottom15") = Right_Bottom(15)
    
    ws.Recordset.Fields("left_top0") = Left_Top(0)
    ws.Recordset.Fields("left_top1") = Left_Top(1)
    ws.Recordset.Fields("left_top2") = Left_Top(2)
    ws.Recordset.Fields("left_top3") = Left_Top(3)
    ws.Recordset.Fields("left_top4") = Left_Top(4)
    ws.Recordset.Fields("left_top5") = Left_Top(5)
    ws.Recordset.Fields("left_top6") = Left_Top(6)
    ws.Recordset.Fields("left_top7") = Left_Top(7)
    ws.Recordset.Fields("left_top8") = Left_Top(8)
    ws.Recordset.Fields("left_top9") = Left_Top(9)
    ws.Recordset.Fields("left_top10") = Left_Top(10)
    ws.Recordset.Fields("left_top11") = Left_Top(11)
    ws.Recordset.Fields("left_top12") = Left_Top(12)
    ws.Recordset.Fields("left_top13") = Left_Top(13)
    ws.Recordset.Fields("left_top14") = Left_Top(14)
    ws.Recordset.Fields("left_top15") = Left_Top(15)
    ws.Recordset.Fields("left_top16") = Left_Top(16)
    ws.Recordset.Fields("left_top17") = Left_Top(17)
    ws.Recordset.Fields("left_Bottom0") = Left_Bottom(0)
    ws.Recordset.Fields("left_Bottom1") = Left_Bottom(1)
    ws.Recordset.Fields("left_Bottom2") = Left_Bottom(2)
    ws.Recordset.Fields("left_Bottom3") = Left_Bottom(3)
    ws.Recordset.Fields("left_Bottom4") = Left_Bottom(4)
    ws.Recordset.Fields("left_Bottom5") = Left_Bottom(5)
    ws.Recordset.Fields("left_Bottom6") = Left_Bottom(6)
    ws.Recordset.Fields("left_Bottom7") = Left_Bottom(7)
    ws.Recordset.Fields("left_Bottom8") = Left_Bottom(8)
    ws.Recordset.Fields("left_Bottom9") = Left_Bottom(9)
    ws.Recordset.Fields("left_Bottom10") = Left_Bottom(10)
    ws.Recordset.Fields("left_Bottom11") = Left_Bottom(11)
    ws.Recordset.Fields("left_Bottom12") = Left_Bottom(12)
    ws.Recordset.Fields("left_Bottom13") = Left_Bottom(13)
    ws.Recordset.Fields("left_Bottom14") = Left_Bottom(14)
    ws.Recordset.Fields("left_Bottom15") = Left_Bottom(15)
    
    ws.Recordset.Fields("realign_rate") = Realign_Rate
    ws.Recordset.Fields("setup_rate") = Setup_Rate
    ws.Recordset.Fields("adjustment_rate") = Adjustment_Rate
    ws.Recordset.Fields("setup_hours") = Setup_Hours
    ws.Recordset.Fields("adjustment_hours") = Adjustment_Hours
    
    ws.Recordset.Fields("rem_control_points") = Rem_Control_Points
    ws.Recordset.Fields("rem_sheet_metal") = Rem_Sheet_Metal
    ws.Recordset.Fields("rem_access") = Rem_Access
    
    ws.Recordset.Fields("sm_units") = SM_Units
    ws.Recordset.Fields("acc_units") = Acc_Units
    ws.Recordset.Fields("code_m_units") = Code_M_Units
    
    ws.Recordset.Update


    Data_Init_Blank


Here is the code when the database is called.

CODE

Begin VB.Data ws
      Caption         =   "star.mdb"
      Connect         =   "Access"
      DatabaseName    =   "star.mdb"
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   240
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   0  'Table
      RecordSource    =   "worksheet"
      Top             =   240
      Visible         =   0   'False
      Width           =   1695
   End


The database is in Access 97. Any ideas on what I might be doing wrong?

Thanks

This post has been edited by PsychoCoder: 20 Jan, 2008 - 11:02 PM
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Help Needed Saving Recorded To Database In VB5
20 Jan, 2008 - 11:03 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,477



Thanked: 161 times
Dream Kudos: 9025
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Why not, while you're at it, rewrite it in VB.Net and make it more efficient. There are very few of us left who even know VB5.
User is online!Profile CardPM
+Quote Post

SilentCodingOne
RE: Help Needed Saving Recorded To Database In VB5
20 Jan, 2008 - 11:25 PM
Post #3

D.I.C Head
**

Joined: 8 Nov, 2007
Posts: 63


My Contributions
I would if I could but the person who owns the program wants it in VB5. However if the database cannot receive saved data in the current format I may be able to convince them. VB.net would make the database connections alot easier. The big issue with that is also that the application has 2 pictures included in it and the only copies still available are stored in the code in *.frx files and are formatted in binary within the file. The pictures are important to the program. If I could convert it out of binary into something like bmp file or gif I probably could get the owner to agree to the .Net conversion. Any ideas on how to pull out the image from the frx file?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 01:07PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month