I could not get the dbEngine(0)(0) thing to work.
The following code works:
Private Sub PalletNumberContainerFormComboBox_AfterUpdate()
DoCmd.RunSQL ("UPDATE Products " & _
"SET Products.ContainerNumberProductsTable =
[Forms]![ContainerAssociationForm]![GETContainerNumber] " & _
"WHERE
(([Products.PalletNumberProductsTable]=[Forms]![ContainerAssociationForm]![PalletNumberContainerFormComboBox]));")
End Sub
But when I try using dbEngine like this:
Private Sub PalletNumberContainerFormComboBox_AfterUpdate()
DBEngine(0)(0).Execute ("UPDATE Products SET
Products.ContainerNumberProductsTable =
[Forms]![ContainerAssociationForm]![GETContainerNumber] WHERE
([Products.PalletNumberProductsTable]=[Forms]![ContainerAssociationForm]![PalletNumberContainerFormComboBox]);"),
dbFailOnError
End Sub
I get the error message: "Too few parameters, expected two." I tried
various changes but I could not get it to work.
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<41***********************@per-qv1-newsreader-01.iinet.net.au>...
You can turn off SetWarnings, and turn it on again later.
Alternatively, Execute your action query like this:
dbEngine(0)(0).Execute "UPDATE ...
That gives you no warning. If you want to stop if there is an error, use:
dbEngine(0)(0).Execute "UPDATE ... ", dbFailOnError
And if you want to be able to roll back the entire thing if there is an
error, use a transaction. Example:
http://members.iinet.net.au/~allenbrowne/ser-37.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"RC" <rc*********@yahoo.com> wrote in message
news:3c**************************@posting.google.c om... In my Access 2002 form, I have a combo box and on the AfterUpdate
event I use
DoCmd.RunSQL ("UPDATE ....
to update records in a table. When it starts to run I get a message
"You are about to update 3 row(s)."
Is there a way to prevent the message from popping up?