Hi all, I encounter this error "TYPE MISMATCH" when i click on my "save" button on my form.
Private Sub Write2DB(ByRef Arr As Variant)
'arr(0) PO#
'arr(1) GL#
'arr(2) Fabric Del Date
'arr(3) Fabrication
'arr(4) Fabric Width
'arr(5) Fabric Color
'arr(6) Net Weight
'arr(7) Gross Weight
'arr(8) Lbs
Lss = (CInt(Arr(7)) - CInt(Arr(6))) / CInt(Arr(6)) * 100 (Type mismatch on this line of code)
'Insert data to MaximMaintable by using SQL
CurrentDb.Execute _
"Insert into MaximMainTable (GLGPO,Mill,[Solid/Printing],Reference,FunctionalFinish,MRName,Buyer,MXDPO,GLA,StyleNo,FabricDelivery,GarmentDelDate,Country,Fabrication,AfterFabricWashWidth,Width,FinishedGoods,GSMPerSqYd,GSMAfterWash,Colour,GroundColour,ComboName,LabDipCode,SampleRequirement,GrossWeight,NettWeight,Lbs,Loss,Yds,Remarks,GarmentSketch,[GarmentSketch2],[GarmentSketch3],[GarmentSketch4],[GarmentSketch5],PrintedRemarks,FabricWeight,UnitPrice,Line,PPSample,POStatus,Amendment,SketchRemark1,SketchRemark2,SketchRemark3,SketchRemark4,SketchRemark5)" & _
"Values (" & Str(Arr(0)) & "','" & Me.cboMill & "','" _
& Me.cboSP & "','" & Me.cboReference & "','" _
& Me.cboFunctionalFinish & "','" & Me.txtMRName & "','" _
& Me.txtBuyer & "','" & Me.txtMXDPO & "','" _
& Str(Arr(1)) & "','" & Me.txtStyleNO & "','" _
& CDate(Arr(2)) & "','" & Me.txtGarmentDelDate & "','" _
& Me.txtCountry & "','" & Str(Arr(3)) & "','" _
& Me.txtFabricWashWidth & "','" & CLng(Arr(4)) & "','" _
& Me.txtFinishedGoods & "','" & Me.txtGSMsq & "','" _
& Me.txtGSMAfterWash & "','" & Str(Arr(5)) & "','" _
& Me.txtGroundColour & "','" & Me.txtComboName & "','" _
& Me.txtLabDipsCode & "','" & Me.txtBuyerRequirement & "','" _
& CLng(Arr(7)) & "','" & CLng(Arr(6)) & "','" & CLng(Arr(8)) _
& CLng(Lss) & "','" & Me.txtYds & "','" _
& Me.txtRemarks & "','" & Me.txtGarmentSketch & "','" _
& Me.txtGarmentSketch2 & "','" & Me.txtGarmentSketch3 & "','" _
& Me.txtGarmentSketch4 & "','" & Me.txtGarmentSketch5 & "','" _
& Me.txtPrintedRemarks & "','" & Me.txtFabricWeight & "','" _
& Me.txtUnitPrice & "','" & Me.txtLine & "','" & Me.txtPPSample & "','" _
& Me.txtPOStatus & "','" & Me.txtAmendment & "','" _
& Me.txtSketchRemark1 & "','" & Me.txtSketchRemark2 & "','" _
& Me.txtSketchRemark3 & "','" & Me.txtSketchRemark4 & "','" _
& Me.txtSketchRemark5 & "')"
'Click on save, all the fields in the textbox will be clear
cmdClear_Click
'Refresh data in list on form to show only data that are not save
Lst_PO.Requery
End Sub
Private Sub Write2DB(ByRef Arr As Variant)
'arr(0) PO#
'arr(1) GL#
'arr(2) Fabric Del Date
'arr(3) Fabrication
'arr(4) Fabric Width
'arr(5) Fabric Color
'arr(6) Net Weight
'arr(7) Gross Weight
'arr(8) Lbs
Lss = (CInt(Arr(7)) - CInt(Arr(6))) / CInt(Arr(6)) * 100 (Type mismatch on this line of code)
'Insert data to MaximMaintable by using SQL
CurrentDb.Execute _
"Insert into MaximMainTable (GLGPO,Mill,[Solid/Printing],Reference,FunctionalFinish,MRName,Buyer,MXDPO,GLA,StyleNo,FabricDelivery,GarmentDelDate,Country,Fabrication,AfterFabricWashWidth,Width,FinishedGoods,GSMPerSqYd,GSMAfterWash,Colour,GroundColour,ComboName,LabDipCode,SampleRequirement,GrossWeight,NettWeight,Lbs,Loss,Yds,Remarks,GarmentSketch,[GarmentSketch2],[GarmentSketch3],[GarmentSketch4],[GarmentSketch5],PrintedRemarks,FabricWeight,UnitPrice,Line,PPSample,POStatus,Amendment,SketchRemark1,SketchRemark2,SketchRemark3,SketchRemark4,SketchRemark5)" & _
"Values (" & Str(Arr(0)) & "','" & Me.cboMill & "','" _
& Me.cboSP & "','" & Me.cboReference & "','" _
& Me.cboFunctionalFinish & "','" & Me.txtMRName & "','" _
& Me.txtBuyer & "','" & Me.txtMXDPO & "','" _
& Str(Arr(1)) & "','" & Me.txtStyleNO & "','" _
& CDate(Arr(2)) & "','" & Me.txtGarmentDelDate & "','" _
& Me.txtCountry & "','" & Str(Arr(3)) & "','" _
& Me.txtFabricWashWidth & "','" & CLng(Arr(4)) & "','" _
& Me.txtFinishedGoods & "','" & Me.txtGSMsq & "','" _
& Me.txtGSMAfterWash & "','" & Str(Arr(5)) & "','" _
& Me.txtGroundColour & "','" & Me.txtComboName & "','" _
& Me.txtLabDipsCode & "','" & Me.txtBuyerRequirement & "','" _
& CLng(Arr(7)) & "','" & CLng(Arr(6)) & "','" & CLng(Arr(8)) _
& CLng(Lss) & "','" & Me.txtYds & "','" _
& Me.txtRemarks & "','" & Me.txtGarmentSketch & "','" _
& Me.txtGarmentSketch2 & "','" & Me.txtGarmentSketch3 & "','" _
& Me.txtGarmentSketch4 & "','" & Me.txtGarmentSketch5 & "','" _
& Me.txtPrintedRemarks & "','" & Me.txtFabricWeight & "','" _
& Me.txtUnitPrice & "','" & Me.txtLine & "','" & Me.txtPPSample & "','" _
& Me.txtPOStatus & "','" & Me.txtAmendment & "','" _
& Me.txtSketchRemark1 & "','" & Me.txtSketchRemark2 & "','" _
& Me.txtSketchRemark3 & "','" & Me.txtSketchRemark4 & "','" _
& Me.txtSketchRemark5 & "')"
'Click on save, all the fields in the textbox will be clear
cmdClear_Click
'Refresh data in list on form to show only data that are not save
Lst_PO.Requery
End Sub