I have a form where the user types the shipping container number into
a box and then types the Pallet number into a combo box. The
AfterUpdate event for the combo box runs the following code which
finds every table row that has that pallet number in it and sets the
container number in the next column to match the container number the
user typed into the form. About 15 rows are changed because there are
about 15 boxes in each pallet.
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE Products " & "SET
Products.ContainerNumberProductsTable =
[Forms]![ContainerAssociationForm]![GETContainerNumber] " & "WHERE
(([Products.PalletNumberProductsTable]=[Forms]![ContainerAssociationForm]![PalletNumberContainerFormComboBox]));")
DoCmd.SetWarnings True
I am using Access 2002. In the database title bar it says "(Access
2000 file format)". In the properties of the form the record source
for the form is the table with all the box and pallet numbers in it.
The database is split and the frontend and backend are both on the
same PC. The database runs only on this PC, it does not run over a
network.
My question is: I this code relatively safe? Do I need to wrap the
procedure in a transaction? I can't tell from all the transaction
messages in the group if I should use a transaction in this case or
not or even whether the form itself handles a type of transaction and
a transaction in code might not work or might mess things up. Should
I add "dbFailOnError" after my UPDATE code?