Delete Command does not work if preceded by un update function.
My function for deleting an object does NOT work properly if it consists of 2 parts, first update and then delete. On the other side, the update function
works excellent if used alone . The delete comamnd also works if used alone. .But in combination of the two i have a problem.
I have a very big and difficult problem with deleting a record.It is very complicated and i will try to make it as short as possible.
I have a database for issuing orders.On the subform i choose different products For a given order i may choose several products.Now i may wanrt to delete
only one product, that is to delete only one row and not all the rows.
In this case, before deleting the product, i must cary out an update query in order to return the product back to the warehosue.
So in short my function consists of 2 parts:
Public Function MyFunction
DoCmd.RunSQL strSQLReturnTheQuantity ( this is an update query that increases the quantity (
First the function updates the quantity, i.e. returns the cartons back to the warehouse,however the product does not disappear from the row
and stays there. After that the function deletes the record. If i remove the update query for the function, and if i leave only the
delete command, then the product disappears from the subform.
I did try with the command DoCmd.GoToControl "Cartons" but the error says object does not exist.
So in short, if my function consists only of the command for deleting, then everything is OK, but if before the delete command i have the update query,
then the product does not disappear from the row and stays there.(the update query is ok in both cases)
I will be very grateful if somebody may wish to help me.Perhaps i should answer some aditional questions.This problem is so important to me.