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