Syntax error (missing operator) in query expression.

mechwarrior3

Well-known member
Joined
Dec 19, 2005
Messages
67
Programming Experience
Beginner
Syntax error (missing operator) in query expression. (Another Update Command Problem)

Hello everyone. :)

So here is the problem: I am trying to update a record within an Access Database. However, at the .Update line, I get the attached error. This database contains one AutoNumber field (nInspUniqueKey) and one Primary Key field (strLotNumber). This is what the entire strCommand variable reads:

"UPDATE tbl_HCI_Lot_Inspection_Data SET strArcTube = ?, strDebindDate = ?, strPrefireDate = ?, strFinalfireDate = ?, strInspectionDate = ?, ysnReclaimed = ?, nLotGross = ?, nLotNet = ?, strIntendedCustomer = ?, nVIGross = ?, intWSDefectives = ?, intCEGGDefectives = ?, intOPDefectives = ?, intBSDefectives = ?, intRSDefectives = ?, intVoidDefectives = ?, intTearOutDefectives = ?, intChipDefectives = ?, intScratchDefectives = ?, intCrackDefectives = ?, intFlashDefectives = ?, intGrayDefectives = ?, intJointDefectives = ?, intOther1Defective = ?, intOther2Defective = ?, intOther3Defective = ?, intVisualDefectsNET = ?, nPinTestGross = ?, intCoaxPinDefectives = ?, int5mmPinDefectives = ?, intCapIDPinDefectives = ?, intNoInsPinDefectives = ?, intFFUHatDefectives = ?, intFFUPinDefectives = ?, intPinTestNET = ?, nWSGross = ?, nBSGross = ?, nRSGross = ?, nVoidGross = ?, nTearOutGross = ?, nCrackGross = ?, nODChipGross = ?, nIDChipGross = ?, nScratchGross = ?, nCEGGGross = ?, nOPGross = ?, nFlashGross = ?, nGrayGross = ?, nJointGross = ?, nOther1Gross = ?, nOther2Gross = ?, nOther3Gross = ?, intTransferred = ?, nCoaxPinGross = ?, n5mmPinGross = ?, nCapIDPinGross = ?, nNoInsPinGross = ?, nFFUHatGross = ?, nFFUPinGross = ?, nDimsLongGross = ?, nDimsShortGross = ?, nDimsBigODGross = ?, nDimsSmallODGross = ?, nDimsBigCapODGross = ?, nDimsSmallCapODGross = ?, strPartNum = ?, nRegrind = ?, strEmployeeID = ?, strPowderLot = ?, strOleicAcidLot = ?, strWaxLot = ?, nFFUGross = ?, intFFUNet = ?, nDimsGross = ?, intDimensionsNET = ?, intLongDefectives = ?, intShortDefectives = ?, intBigODDefectives = ?, intSmallODDefectives = ?, intBigCapODDefectives = ?, intSmallCapODDefectives = ? WHERE strMixID = ? AND strLotNumber = ?"

I apologize for its size but I put the whole thing here because I thought it would be necessary for a correct analysis of the problem.

I do not get this error when I am inserting data into the database. I have tried that and it worked fine.

Can you see where my error is? Is this error caused by something unrelated to the actual command string? Any suggestions will be greatly appreciated. :)
 

Attachments

  • AnotherParameterError.JPG
    AnotherParameterError.JPG
    36.5 KB · Views: 193
Last edited:
I have another question about this problem. (I realize this is a double post, but I wanted to bump the thread at the same time.) How come the query expression the error gives me looks nothing like the UPDATE command I am passing in?
 
I was wondering that very same thing.... can you post the code you are using? Specificaly where you are creating and filling your datatable/set and how you are invoking the UPDATE?

-tg
 
Sure thing. :D

VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] AccessConn [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDb.OleDbConnection(MYACCESSCONN) [/SIZE][SIZE=2][COLOR=#008000]' Main Access Database connection
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] AccessCommand [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDb.OleDbCommand(strCommand) ' strCommand is the UPDATE command from first post.[/SIZE][SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] AccessDataSet [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] System.Data.DataSet
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] AccessAdapter [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDb.OleDbDataAdapter[/SIZE]
 
' Then here come all of the parameter adds
[SIZE=2][SIZE=2]AccessAdapter.SelectCommand = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDb.OleDbCommand("SELECT * FROM tbl_HCI_Lot_Inspection_Data WHERE strMixID = ? AND strLotNumber = ?", AccessConn)
AccessAdapter.SelectCommand.Parameters.Add("@MixNum", OleDb.OleDbType.VarChar, 50, "strMixID").Value = strMixLotNum
AccessAdapter.SelectCommand.Parameters.Add("@MfgNum", OleDb.OleDbType.VarChar, 50, "strLotNumber").Value = strMfgLotNum
AccessAdapter.UpdateCommand = AccessCommand
AccessAdapter.UpdateCommand.Connection = AccessConn
AccessAdapter.UpdateCommand.Parameters.Add("@ArcNum", OleDb.OleDbType.VarChar, 50, "strArcTube")
AccessAdapter.UpdateCommand.Parameters.Add("@DBDate", OleDb.OleDbType.VarChar, 50, "strDebindDate")
AccessAdapter.UpdateCommand.Parameters.Add("@PSDate", OleDb.OleDbType.VarChar, 50, "strPreFireDate")
AccessAdapter.UpdateCommand.Parameters.Add("@SDate", OleDb.OleDbType.VarChar, 50, "strFinalFireDate")
AccessAdapter.UpdateCommand.Parameters.Add("@SInspDate", OleDb.OleDbType.VarChar, 50, "strInspectionDate")
AccessAdapter.UpdateCommand.Parameters.Add("@Rclmd", OleDb.OleDbType.Boolean, 5, "ysnReclaimed")
AccessAdapter.UpdateCommand.Parameters.Add("@Gross", OleDb.OleDbType.Integer, 3, "nLotGross")
AccessAdapter.UpdateCommand.Parameters.Add("@Net", OleDb.OleDbType.Integer, 3, "nLotNet")
AccessAdapter.UpdateCommand.Parameters.Add("@Cust", OleDb.OleDbType.VarChar, 50, "strIntendedCustomer")
AccessAdapter.UpdateCommand.Parameters.Add("@VDGross", OleDb.OleDbType.Integer, 3, "nVIGross")
AccessAdapter.UpdateCommand.Parameters.Add("@WS", OleDb.OleDbType.Integer, 3, "intWSDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@CEGG", OleDb.OleDbType.Integer, 3, "intCEGGDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@OP", OleDb.OleDbType.Integer, 3, "intOPDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@BS", OleDb.OleDbType.Integer, 3, "intBSDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@RS", OleDb.OleDbType.Integer, 3, "intRSDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@Void", OleDb.OleDbType.Integer, 3, "intVoidDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@Tear", OleDb.OleDbType.Integer, 3, "intTearOutDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@Chip", OleDb.OleDbType.Integer, 3, "intChipDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@Scratch", OleDb.OleDbType.Integer, 3, "intScratchDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@Crack", OleDb.OleDbType.Integer, 3, "intCrackDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@Flash", OleDb.OleDbType.Integer, 3, "intFlashDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@Gray", OleDb.OleDbType.Integer, 3, "intGrayDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@Joint", OleDb.OleDbType.Integer, 3, "intJointDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@Other1", OleDb.OleDbType.Integer, 3, "intOther1Defective")
AccessAdapter.UpdateCommand.Parameters.Add("@Other2", OleDb.OleDbType.Integer, 3, "intOther2Defective")
AccessAdapter.UpdateCommand.Parameters.Add("@Other3", OleDb.OleDbType.Integer, 3, "intOther3Defective")
AccessAdapter.UpdateCommand.Parameters.Add("@VDNet", OleDb.OleDbType.Integer, 3, "intVisualDefectsNET")
AccessAdapter.UpdateCommand.Parameters.Add("@PTGross", OleDb.OleDbType.Integer, 3, "nPinTestGross")
AccessAdapter.UpdateCommand.Parameters.Add("@Coax", OleDb.OleDbType.Integer, 3, "intCoaxPinDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@5mm", OleDb.OleDbType.Integer, 3, "int5mmPinDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@CapID", OleDb.OleDbType.Integer, 3, "intCapIDPinDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@NoIns", OleDb.OleDbType.Integer, 3, "intNoInsPinDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@FFUH", OleDb.OleDbType.Integer, 3, "intFFUHatDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@FFUP", OleDb.OleDbType.Integer, 3, "intFFUPinDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@PTNet", OleDb.OleDbType.Integer, 3, "intPinTestNET")
AccessAdapter.UpdateCommand.Parameters.Add("@WSGross", OleDb.OleDbType.Integer, 3, "nWSGross")
AccessAdapter.UpdateCommand.Parameters.Add("@BSGross", OleDb.OleDbType.Integer, 3, "nBSGross")
AccessAdapter.UpdateCommand.Parameters.Add("@RSGross", OleDb.OleDbType.Integer, 3, "nRSGross")
AccessAdapter.UpdateCommand.Parameters.Add("@VoidGross", OleDb.OleDbType.Integer, 3, "nVoidGross")
AccessAdapter.UpdateCommand.Parameters.Add("@TearOutGross", OleDb.OleDbType.Integer, 3, "nTearOutGross")
AccessAdapter.UpdateCommand.Parameters.Add("@CrackGross", OleDb.OleDbType.Integer, 3, "nCrackGross")
AccessAdapter.UpdateCommand.Parameters.Add("@ODChipGross", OleDb.OleDbType.Integer, 3, "nODChipGross")
AccessAdapter.UpdateCommand.Parameters.Add("@IDChipGross", OleDb.OleDbType.Integer, 3, "nIDChipGross")
AccessAdapter.UpdateCommand.Parameters.Add("@ScratchGross", OleDb.OleDbType.Integer, 3, "nScratchGross")
AccessAdapter.UpdateCommand.Parameters.Add("@CEGGGross", OleDb.OleDbType.Integer, 3, "nCEGGGross")
AccessAdapter.UpdateCommand.Parameters.Add("@OPGross", OleDb.OleDbType.Integer, 3, "nOPGross")
AccessAdapter.UpdateCommand.Parameters.Add("@FlashGross", OleDb.OleDbType.Integer, 3, "nFlashGross")
AccessAdapter.UpdateCommand.Parameters.Add("@GrayGross", OleDb.OleDbType.Integer, 3, "nGrayGross")
AccessAdapter.UpdateCommand.Parameters.Add("@JointGross", OleDb.OleDbType.Integer, 3, "nJointGross")
AccessAdapter.UpdateCommand.Parameters.Add("@Other1Gross", OleDb.OleDbType.Integer, 3, "nOther1Gross")
AccessAdapter.UpdateCommand.Parameters.Add("@Other2Gross", OleDb.OleDbType.Integer, 3, "nOther2Gross")
AccessAdapter.UpdateCommand.Parameters.Add("@Other3Gross", OleDb.OleDbType.Integer, 3, "nOther3Gross")
AccessAdapter.UpdateCommand.Parameters.Add("@Manchester", OleDb.OleDbType.Integer, 3, "intTransferred")
AccessAdapter.UpdateCommand.Parameters.Add("@CoaxGross", OleDb.OleDbType.Integer, 3, "nCoaxPinGross")
AccessAdapter.UpdateCommand.Parameters.Add("@5mmGross", OleDb.OleDbType.Integer, 3, "n5mmPinGross")
AccessAdapter.UpdateCommand.Parameters.Add("@CapIDGross", OleDb.OleDbType.Integer, 3, "nCapIDPinGross")
AccessAdapter.UpdateCommand.Parameters.Add("@NoInsGross", OleDb.OleDbType.Integer, 3, "nNoInsPinGross")
AccessAdapter.UpdateCommand.Parameters.Add("@FFUHGross", OleDb.OleDbType.Integer, 3, "nFFUHatGross")
AccessAdapter.UpdateCommand.Parameters.Add("@FFUPGross", OleDb.OleDbType.Integer, 3, "nFFUPinGross")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsLongGross", OleDb.OleDbType.Integer, 3, "nDimsLongGross")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsShortGross", OleDb.OleDbType.Integer, 3, "nDimsShortGross")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsBigODGross", OleDb.OleDbType.Integer, 3, "nDimsBigODGross")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsSmallODGross", OleDb.OleDbType.Integer, 3, "nDimsSmallODGross")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsBigCapODGross", OleDb.OleDbType.Integer, 3, "nDimsBigCapODGross")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsSmallCapODGross", OleDb.OleDbType.Integer, 3, "nDimsSmallCapODGross")
AccessAdapter.UpdateCommand.Parameters.Add("@PartNum", OleDb.OleDbType.VarChar, 50, "strPartNum")
AccessAdapter.UpdateCommand.Parameters.Add("@RegrindGross", OleDb.OleDbType.Integer, 3, "nRegrind")
AccessAdapter.UpdateCommand.Parameters.Add("@ODChip", OleDb.OleDbType.Integer, 3, "intODChipDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@IDChip", OleDb.OleDbType.Integer, 3, "intIDChipDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@EmpID", OleDb.OleDbType.VarChar, 50, "strEmployeeID")
AccessAdapter.UpdateCommand.Parameters.Add("@PowderLot", OleDb.OleDbType.VarChar, 50, "strPowderLot")
AccessAdapter.UpdateCommand.Parameters.Add("@OleicAcidLot", OleDb.OleDbType.VarChar, 50, "strOleicAcidLot")
AccessAdapter.UpdateCommand.Parameters.Add("@WaxLot", OleDb.OleDbType.VarChar, 50, "strWaxLot")
AccessAdapter.UpdateCommand.Parameters.Add("@FFUGross", OleDb.OleDbType.Integer, 3, "nFFUGross")
AccessAdapter.UpdateCommand.Parameters.Add("@FFUNet", OleDb.OleDbType.Integer, 3, "intFFUNet")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsGross", OleDb.OleDbType.Integer, 3, "nDimsGross")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsNet", OleDb.OleDbType.Integer, 3, "intDimensionsNET")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsLong", OleDb.OleDbType.Integer, 3, "intLongDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsShort", OleDb.OleDbType.Integer, 3, "intShortDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsBigOD", OleDb.OleDbType.Integer, 3, "intBigODDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsSmallOD", OleDb.OleDbType.Integer, 3, "intSmallODDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsBigCapOD", OleDb.OleDbType.Integer, 3, "intBigCapODDefectives")
AccessAdapter.UpdateCommand.Parameters.Add("@DimsSmallCapOD", OleDb.OleDbType.Integer, 3, "intSmallCapODDefectives")
[/SIZE][SIZE=2][COLOR=#008000]
[/COLOR][/SIZE][SIZE=2]AccessAdapter.UpdateCommand.Parameters.Add("@MixNum", OleDb.OleDbType.VarChar, 50, "strMixID")
AccessAdapter.UpdateCommand.Parameters.Add("@MfgNum", OleDb.OleDbType.VarChar, 50, "strLotNumber")
 
' Then I fill the dataset
[SIZE=2]AccessAdapter.Fill(AccessDataSet, "tbl_HCI_Lot_Inspection_Data")
 
' Then I add in all the information I need.
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] AccessDataRow [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataRow = AccessDataSet.Tables("tbl_HCI_Lot_Inspection_Data").Rows(0)
AccessDataRow("strArcTube") = strArcTubeType
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].txtDebindDate.Text = "") [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]dteDebindDate = #1/1/0100#
[/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2]dteDebindDate = DateTime.Parse([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].txtDebindDate.Text)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2]AccessDataRow("strDebindDate") = dteDebindDate
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].txtPreSinDate.Text = "") [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]dtePresinDate = #1/1/0100#
[/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2]dtePresinDate = DateTime.Parse([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].txtPreSinDate.Text)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2]AccessDataRow("strPreFireDate") = dtePresinDate
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].txtSinDate.Text = "") [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]dteSinDate = #1/1/0100#
[/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2]dteSinDate = DateTime.Parse([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].txtSinDate.Text)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2]AccessDataRow("strFinalFireDate") = dteSinDate
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].txtInspDate.Text = "") [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]dteInspDate = #1/1/0100#
[/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2]dteInspDate = DateTime.Parse([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].txtInspDate.Text)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2]AccessDataRow("strInspectionDate") = dteInspDate
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].chkReclaimed.Checked) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]AccessDataRow("ysnReclaimed") = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2]AccessDataRow("ysnReclaimed") = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2]AccessDataRow("nLotGross") = max
AccessDataRow("nLotNet") = min
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] (opbBerlin.Checked) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]AccessDataRow("strIntendedCustomer") = "1"
[/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] (opbManchester.Checked) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]AccessDataRow("strIntendedCustomer") = "2"
[/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] (opbOtherSpec.Checked) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]AccessDataRow("strIntendedCustomer") = "3"
[/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2]AccessDataRow("strIntendedCustomer") = ""
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2]AccessDataRow("nVIGross") = lngVDStartAmt
AccessDataRow("intWSDefectives") = VDWSCnt
AccessDataRow("intCEGGDefectives") = VDCEGGCnt
AccessDataRow("intOPDefectives") = VDOPCnt
AccessDataRow("intBSDefectives") = VDBSCnt
AccessDataRow("intRSDefectives") = VDRSCnt
AccessDataRow("intVoidDefectives") = VDVoidCnt
AccessDataRow("intTearOutDefectives") = VDTearOutCnt
AccessDataRow("intChipDefectives") = VDODChipCnt + VDIDChipCnt
AccessDataRow("intScratchDefectives") = VDScratchCnt
AccessDataRow("intCrackDefectives") = VDCrackCnt
AccessDataRow("intFlashDefectives") = VDFlashCnt
AccessDataRow("intGrayDefectives") = VDGrayCnt
AccessDataRow("intJointDefectives") = VDJointDefectCnt
AccessDataRow("intOther1Defective") = VDOther1Cnt
AccessDataRow("intOther2Defective") = VDOther2Cnt
AccessDataRow("intOther3Defective") = VDOther3Cnt
AccessDataRow("intVisualDefectsNET") = lngVDEndAmt
AccessDataRow("nPinTestGross") = lngPTStartAmt
AccessDataRow("intCoaxPinDefectives") = PTCoaxCnt
AccessDataRow("int5mmPinDefectives") = PT5mmCnt
AccessDataRow("intCapIDPinDefectives") = PTCapIDCnt
AccessDataRow("intNoInsPinDefectives") = PTNoInsCnt
AccessDataRow("intFFUHatDefectives") = FFUHCnt
AccessDataRow("intFFUPinDefectives") = FFUPCnt
AccessDataRow("intPinTestNET") = lngPTEndAmt
AccessDataRow("nWSGross") = lngVDStartAmt
AccessDataRow("nBSGross") = lngVDStartAmt - VDWSCnt
AccessDataRow("nRSGross") = lngVDStartAmt - VDWSCnt - VDBSCnt
AccessDataRow("nVoidGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt
AccessDataRow("nTearOutGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt
AccessDataRow("nCrackGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt
AccessDataRow("nODChipGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt
AccessDataRow("nIDChipGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - VDODChipCnt
AccessDataRow("nScratchGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - (VDODChipCnt + VDIDChipCnt)
AccessDataRow("nCEGGGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - (VDODChipCnt + VDIDChipCnt) - VDScratchCnt
AccessDataRow("nOPGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - (VDODChipCnt + VDIDChipCnt) - VDScratchCnt - VDCEGGCnt
AccessDataRow("nFlashGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - (VDODChipCnt + VDIDChipCnt) - VDScratchCnt - VDCEGGCnt - VDOPCnt
AccessDataRow("nGrayGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - (VDODChipCnt + VDIDChipCnt) - VDScratchCnt - VDCEGGCnt - VDOPCnt - VDFlashCnt
AccessDataRow("nJointGross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - (VDODChipCnt + VDIDChipCnt) - VDScratchCnt - VDCEGGCnt - VDOPCnt - VDFlashCnt - VDGrayCnt
AccessDataRow("nOther1Gross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - (VDODChipCnt + VDIDChipCnt) - VDScratchCnt - VDCEGGCnt - VDOPCnt - VDFlashCnt - VDGrayCnt _
- VDJointDefectCnt
AccessDataRow("nOther2Gross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - (VDODChipCnt + VDIDChipCnt) - VDScratchCnt - VDCEGGCnt - VDOPCnt - VDFlashCnt - VDGrayCnt _
- VDJointDefectCnt - VDOther1Cnt
AccessDataRow("nOther3Gross") = lngVDStartAmt - VDWSCnt - VDBSCnt - VDRSCnt - VDVoidCnt - VDTearOutCnt _
- VDCrackCnt - (VDODChipCnt + VDIDChipCnt) - VDScratchCnt - VDCEGGCnt - VDOPCnt - VDFlashCnt - VDGrayCnt _
- VDJointDefectCnt - VDOther1Cnt - VDOther2Cnt
AccessDataRow("intTransferred") = VDManchesterCnt
AccessDataRow("nCoaxPinGross") = lngPTStartAmt
AccessDataRow("n5mmPinGross") = lngPTStartAmt - PTCoaxCnt
AccessDataRow("nCapIDPinGross") = lngPTStartAmt - PTCoaxCnt - PT5mmCnt
AccessDataRow("nNoInsPinGross") = lngPTStartAmt - PTCoaxCnt - PT5mmCnt - PTCapIDCnt
AccessDataRow("nFFUHatGross") = lngFFUStartAmt
AccessDataRow("nFFUPinGross") = lngFFUStartAmt - FFUHCnt
AccessDataRow("nDimsLongGross") = lngDimsStartAmt
AccessDataRow("nDimsShortGross") = lngDimsStartAmt - DimsLongCnt
AccessDataRow("nDimsBigODGross") = lngDimsStartAmt - DimsLongCnt - DimsShortCnt
AccessDataRow("nDimsSmallODGross") = lngDimsStartAmt - DimsLongCnt - DimsShortCnt - DimsBigODCnt
AccessDataRow("nDimsBigCapODGross") = lngDimsStartAmt - DimsLongCnt - DimsShortCnt - DimsBigODCnt - DimsSmallODCnt
AccessDataRow("nDimsSmallCapODGross") = lngDimsStartAmt - DimsLongCnt - DimsShortCnt - DimsBigODCnt - DimsSmallODCnt _
- DimsBigCapODCnt
AccessDataRow("strPartNum") = strPartNum
AccessDataRow("nRegrind") = VDRegrindCnt
AccessDataRow("intODChipDefectives") = VDODChipCnt
AccessDataRow("intIDChipDefectives") = VDIDChipCnt
AccessDataRow("strEmployeeID") = strEmployeeID
AccessDataRow("strPowderLot") = strPowderLotNum
AccessDataRow("strOleicAcidLot") = strOleicAcidLotNum
AccessDataRow("strWaxLot") = strWaxLotNum
AccessDataRow("nFFUGross") = lngFFUStartAmt
AccessDataRow("intFFUNet") = lngFFUEndAmt
AccessDataRow("nDimsGross") = lngDimsStartAmt
AccessDataRow("intDimensionsNET") = lngDimsEndAmt
AccessDataRow("intLongDefectives") = DimsLongCnt
AccessDataRow("intShortDefectives") = DimsShortCnt
AccessDataRow("intBigODDefectives") = DimsBigODCnt
AccessDataRow("intSmallODDefectives") = DimsSmallODCnt
AccessDataRow("intBigCapODDefectives") = DimsBigCapODCnt
AccessDataRow("intSmallCapODDefectives") = DimsSmallCapODCnt
 
[SIZE=2]AccessAdapter.UpdateCommand = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDb.OleDbCommandBuilder(AccessAdapter).GetUpdateCommand[/SIZE]
 
' Then try to update the dataset and database. Here is where the error in the first post occurs.
[SIZE=2][SIZE=2][COLOR=#0000ff]Try
[/COLOR][/SIZE][SIZE=2]AccessAdapter.Update(AccessDataSet, "tbl_HCI_Lot_Inspection_Data")
[/SIZE][SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] oledbEx [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] OleDb.OleDbException
MessageBox.Show(oledbEx.ToString)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Try[/COLOR][/SIZE]
[/SIZE][/SIZE][/SIZE][/SIZE][/SIZE]


Sorry about all the code. There are a lot of parameters that need to be added. Also, I have adjusted the UPDATE command since my first post. I noticed that intODChipDefectives and intIDChipDefectives are not accounted for in the UPDATE command in the first post. I fixed that but still it did not fix the problem. I've also tried to ensure that every field I am updating is not blank. I had read that that was a possible solution to this problem. However, that did not seem to fix anything. Again, I do not get an error when using an INSERT command with all of the same parameters. One other note: the database has more fields than what my UPDATE command updates. Could this be the problem? Thanks for your reply, TG. :)
 
(Again, another double post...)

I found out why the query expression the error is showing me is so screwed up. It's the result of my CommandBuilder line of code (see post #4). If I don't include that line, I get the exact line that is written above in the first post. And now I just get this error which is attached. This is getting to be a really annoying problem...
 

Attachments

  • UpdateSyntaxError.JPG
    UpdateSyntaxError.JPG
    26 KB · Views: 173
Resolved!!!

The problem is resolved! I found that there is a comma just before the WHERE clause! That was the typo! My whole project has been held up because of a comma! But I deleted it and now everything works! :D
 
Back
Top