I have been using this delete query for many months in a vb.net program and it has run perfectly, but as of yesterday when it is run the following message appears. Basically the delete query looks for duplicates and only deletes duplicates and keeps the first entry of that duplicate.
First below is the delete query...
sSQL = "DELETE [Lab Table].TDate, [Lab Table].ID, [Lab Table].Qty, * FROM [Lab Table] WHERE ((([Lab Table].TDate) " & _
" Between Date()-10 And Date()) AND (([Lab Table].ID) Not In (SELECT Min(ID) as MinID FROM [Lab Table] " & _
"WHERE ([Lab Table].TDate Between Date()-10 And Date()) GROUP BY [Lab Table].LotNumber)) AND (([Lab Table].Qty)=[Lab Table].[Qty]));"
ERROR MESSAGE....
System.Data.OleDb.OleDbException.Synteax error (missing operator) in query expression " (LBL 'S I')'.
at system.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorhandling(Int32hr)
at System.Dat.OleDb.OleDbCommand.ExecuteCommandTextforSingleResult(tagDBPARAMS dbParams, Objects& executeResult)
at system.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at system.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavoir, ObjectsResult)
at system.Data.OleDb.OleDbCommand.ExecuteReaderInternal(COmmandbehavior, String method)
at system.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at MAX_Data_Interace.From1.btnloadAccess_Click(Object sender, EventArgs e)............................
Where should I look to correct this? For the query to duplicate will not run now. Thanks
First below is the delete query...
sSQL = "DELETE [Lab Table].TDate, [Lab Table].ID, [Lab Table].Qty, * FROM [Lab Table] WHERE ((([Lab Table].TDate) " & _
" Between Date()-10 And Date()) AND (([Lab Table].ID) Not In (SELECT Min(ID) as MinID FROM [Lab Table] " & _
"WHERE ([Lab Table].TDate Between Date()-10 And Date()) GROUP BY [Lab Table].LotNumber)) AND (([Lab Table].Qty)=[Lab Table].[Qty]));"
ERROR MESSAGE....
System.Data.OleDb.OleDbException.Synteax error (missing operator) in query expression " (LBL 'S I')'.
at system.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorhandling(Int32hr)
at System.Dat.OleDb.OleDbCommand.ExecuteCommandTextforSingleResult(tagDBPARAMS dbParams, Objects& executeResult)
at system.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at system.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavoir, ObjectsResult)
at system.Data.OleDb.OleDbCommand.ExecuteReaderInternal(COmmandbehavior, String method)
at system.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at MAX_Data_Interace.From1.btnloadAccess_Click(Object sender, EventArgs e)............................
Where should I look to correct this? For the query to duplicate will not run now. Thanks