private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset) { //* //cnnDB.Execute "SELECT * FROM StockTake" //*Updating the StockTake_Add field // cnnDB.Execute "UPDATE StockTake SET StockTake.StockTake_Add = " & adoPrimaryRS("StockTake_Adjustment") & " WHERE (((StockTake.StockTake_StockItemID)=" & adoPrimaryRS("StockTake_StockItemID") & ") AND ((StockTake.StockTake_WarehouseID)=2));" //check = adoPrimaryRS("StockTake_Add") //* }
private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset) { int lQuantity = 0; if (adoPrimaryRS.Fields("StockTakeDeposit_Quantity").OriginalValue != adoPrimaryRS.Fields("StockTakeDeposit_Quantity").Value) { lQuantity = Convert.ToInt32(adoPrimaryRS.Fields("StockTakeDeposit_Quantity").Value) - Convert.ToInt32(adoPrimaryRS.Fields("StockTakeDeposit_Quantity").OriginalValue); modRecordSet.cnnDB.Execute("UPDATE WarehouseDepositItemLnk SET WarehouseDepositItemLnk.WarehouseDepositItemLnk_Quantity = [WarehouseDepositItemLnk]![WarehouseDepositItemLnk_Quantity]+(" + lQuantity + ") WHERE (((WarehouseDepositItemLnk.WarehouseDepositItemLnk_WarehouseID)=" + adoPrimaryRS.Fields("StockTakeDeposit_WarehouseID").Value + ") AND ((WarehouseDepositItemLnk.WarehouseDepositItemLnk_DepositID)=" + adoPrimaryRS.Fields("StockTakeDeposit_DepositID").Value + ") AND ((WarehouseDepositItemLnk.WarehouseDepositItemLnk_DepositTypeID)=" + adoPrimaryRS.Fields(1).Value + "));"); modRecordSet.cnnDB.Execute("UPDATE Company INNER JOIN DayEndDepositItemLnk ON Company.Company_DayEndID = DayEndDepositItemLnk.DayEndDepositItemLnk_DayEndID SET DayEndDepositItemLnk.DayEndDepositItemLnk_QuantityShrink = [DayEndDepositItemLnk]![DayEndDepositItemLnk_QuantityShrink]+" + lQuantity + " WHERE (((DayEndDepositItemLnk.DayEndDeposittemLnk_DepositID)=" + adoPrimaryRS.Fields("StockTakeDeposit_DepositID").Value + ") AND ((DayEndDepositItemLnk.DayEndDeposittemLnk_DepositType)=" + adoPrimaryRS.Fields(1).Value + "));"); doDiskFlush(); } }
private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset) { int lQuantity = 0; if (adoPrimaryRS.Fields("Reference").OriginalValue != adoPrimaryRS.Fields("Reference").Value) { //cnndb.Execute "Update PastelDescription Set Narrative =' } if (adoPrimaryRS.Fields("AccountNumber").OriginalValue != adoPrimaryRS.Fields("AccountNumber").Value) { //cnnDB.Execute "Update PastelDescription Set AccountNumber =' " } }
private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset) { //This is where you put validation code //This event gets called when the following actions occur bool bCancel = false; switch (adReason) { case ADODB.EventReasonEnum.adRsnAddNew: break; case ADODB.EventReasonEnum.adRsnClose: break; case ADODB.EventReasonEnum.adRsnDelete: break; case ADODB.EventReasonEnum.adRsnFirstChange: break; case ADODB.EventReasonEnum.adRsnMove: break; case ADODB.EventReasonEnum.adRsnRequery: break; case ADODB.EventReasonEnum.adRsnResynch: break; case ADODB.EventReasonEnum.adRsnUndoAddNew: break; case ADODB.EventReasonEnum.adRsnUndoDelete: break; case ADODB.EventReasonEnum.adRsnUndoUpdate: break; case ADODB.EventReasonEnum.adRsnUpdate: break; } if (bCancel) { adStatus = ADODB.EventStatusEnum.adStatusCancel; } }
private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset) { int lQuantity = 0; bool bCancel = false; switch (adReason) { case ADODB.EventReasonEnum.adRsnAddNew: break; case ADODB.EventReasonEnum.adRsnClose: break; case ADODB.EventReasonEnum.adRsnDelete: break; case ADODB.EventReasonEnum.adRsnFirstChange: break; case ADODB.EventReasonEnum.adRsnMove: break; case ADODB.EventReasonEnum.adRsnRequery: break; case ADODB.EventReasonEnum.adRsnResynch: break; case ADODB.EventReasonEnum.adRsnUndoAddNew: break; case ADODB.EventReasonEnum.adRsnUndoDelete: break; case ADODB.EventReasonEnum.adRsnUndoUpdate: break; case ADODB.EventReasonEnum.adRsnUpdate: break; } if (bCancel) { adStatus = ADODB.EventStatusEnum.adStatusCancel; } }
private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset) { decimal lQuantity = default(decimal); //Long if (blHandHeld == true) { if (adoPrimaryRS.Fields("Quantity").OriginalValue != adoPrimaryRS.Fields("Quantity").Value) { lQuantity = adoPrimaryRS.Fields("Quantity").Value; modRecordSet.cnnDB.Execute("UPDATE " + modApplication.stTableName + " SET Quantity = " + lQuantity + " WHERE " + modApplication.stTableName + ".HandHeldID = " + adoPrimaryRS.Fields("StockTake_StockItemID").Value); doDiskFlush(); } } else { if (Convert.ToDecimal(adoPrimaryRS.Fields("StockTake_Quantity").OriginalValue) != Convert.ToDecimal(adoPrimaryRS.Fields("StockTake_Quantity").Value)) { //lQuantity = adoPrimaryRS("StockTake_Quantity") '- adoPrimaryRS("StockTake_Quantity").OriginalValue //* lQuantity = adoPrimaryRS.Fields("StockTake_Quantity").Value - adoPrimaryRS.Fields("StockTake_Quantity").OriginalValue; //cnnDB.Execute "UPDATE StockTake SET StockTake.StockTake_Quantity = [StockTake]![StockTake_Quantity]+(" & lQuantity & ") WHERE (((StockTake.StockTake_StockItemID)=" & adoPrimaryRS("StockTake_StockItemID") & ") AND ((StockTake.StockTake_WarehouseID)=2));" //Multi Warehouse change //cnnDB.Execute "UPDATE WarehouseStockItemLnk INNER JOIN StockTake ON (StockTake.StockTake_WarehouseID = WarehouseStockItemLnk.WarehouseStockItemLnk_WarehouseID) AND (WarehouseStockItemLnk.WarehouseStockItemLnk_StockItemID = StockTake.StockTake_StockItemID) SET WarehouseStockItemLnk.WarehouseStockItemLnk_Quantity = [WarehouseStockItemLnk]![WarehouseStockItemLnk_Quantity]+(" & lQuantity & ") WHERE (((StockTake.StockTake_StockItemID)=" & adoPrimaryRS("StockTake_StockItemID") & ") AND ((StockTake.StockTake_WarehouseID)=2));" //cnnDB.Execute "UPDATE DayEndStockItemLnk INNER JOIN Company ON DayEndStockItemLnk.DayEndStockItemLnk_DayEndID = Company.Company_DayEndID SET DayEndStockItemLnk.DayEndStockItemLnk_QuantityShrink = [DayEndStockItemLnk]![DayEndStockItemLnk_QuantityShrink]-(" & lQuantity & ") WHERE (((DayEndStockItemLnk.DayEndStockItemLnk_StockItemID)=" & adoPrimaryRS("StockTake_StockItemID") & "));" modRecordSet.cnnDB.Execute("UPDATE WarehouseStockItemLnk INNER JOIN StockTake ON (StockTake.StockTake_WarehouseID = WarehouseStockItemLnk.WarehouseStockItemLnk_WarehouseID) AND (WarehouseStockItemLnk.WarehouseStockItemLnk_StockItemID = StockTake.StockTake_StockItemID) SET WarehouseStockItemLnk.WarehouseStockItemLnk_Quantity = [WarehouseStockItemLnk]![WarehouseStockItemLnk_Quantity]+(" + lQuantity + ") WHERE (((StockTake.StockTake_StockItemID)=" + adoPrimaryRS.Fields("StockTake_StockItemID").Value + ") AND ((StockTake.StockTake_WarehouseID)=" + lMWNo + "));"); modRecordSet.cnnDB.Execute("UPDATE DayEndStockItemLnk INNER JOIN Company ON DayEndStockItemLnk.DayEndStockItemLnk_DayEndID = Company.Company_DayEndID SET DayEndStockItemLnk.DayEndStockItemLnk_QuantityShrink = [DayEndStockItemLnk]![DayEndStockItemLnk_QuantityShrink]-(" + lQuantity + ") WHERE (((DayEndStockItemLnk.DayEndStockItemLnk_StockItemID)=" + adoPrimaryRS.Fields("StockTake_StockItemID").Value + ") AND ((DayEndStockItemLnk.DayEndStockItemLnk_Warehouse)=" + lMWNo + "));"); //Multi Warehouse change //* //cnnDB.Execute "UPDATE StockTake SET StockTake.StockTake_Quantity = [StockTake]![StockTake_Quantity]+(" & lQuantity & ") WHERE (((StockTake.StockTake_StockItemID)=" & adoPrimaryRS("StockTake_StockItemID") & ") AND ((StockTake.StockTake_WarehouseID)=2));" //cnnDB.Execute "UPDATE WarehouseStockItemLnk INNER JOIN StockTake ON (StockTake.StockTake_WarehouseID = WarehouseStockItemLnk.WarehouseStockItemLnk_WarehouseID) AND (WarehouseStockItemLnk.WarehouseStockItemLnk_StockItemID = StockTake.StockTake_StockItemID) SET WarehouseStockItemLnk.WarehouseStockItemLnk_Quantity = (" & lQuantity & ") WHERE (((StockTake.StockTake_StockItemID)=" & adoPrimaryRS("StockTake_StockItemID") & ") AND ((StockTake.StockTake_WarehouseID)=2));" //cnnDB.Execute "UPDATE DayEndStockItemLnk INNER JOIN Company ON DayEndStockItemLnk.DayEndStockItemLnk_DayEndID = Company.Company_DayEndID SET DayEndStockItemLnk.DayEndStockItemLnk_QuantityShrink = (" & lQuantity & ") WHERE (((DayEndStockItemLnk.DayEndStockItemLnk_StockItemID)=" & adoPrimaryRS("StockTake_StockItemID") & "));" doDiskFlush(); } } }
private void adoPrimaryRS_MoveComplete(ADODB.EventReasonEnum adReason, ADODB.Error pError, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset) { //This will display the current record position for this recordset }
private void adoPrimaryRS_WillChangeRecord(ADODB.EventReasonEnum adReason, int cRecords, ref ADODB.EventStatusEnum adStatus, ADODB.Recordset pRecordset) { }