There are at least two problems with your syntax
1) IIF() is the "Immediate If" function, and is not used at all like
you have indicated. It is used like this:
X=IIF(A=1,2,3)
where x will be assigned the value "2" if A=1, otherwise it will be
assigned the value "3"
2) .AfterUpdate is an event handler -- it is not a variable that you
can use in a comparison.
I am guessing that you wanted something like:
IF ([Products]![PalletNumberProductsTable] = _
Forms![ContainerAssociationForm]![PalletNumberContainerFormComboBox]
Then
[Products]![ContainerNumberProductsTable] = _
Forms![ContainerAssociationForm]![GETContainerNumber])
EndIf
Note that neither of these two items pertain to my original suggestion
of using an update query. Judging by your code in another message, I
would probably use something like:
sSQL = "UPDATE Products SET [ContainerNumberProductsTable] = " & _
Forms![ContainerAssociationForm]![GETContainerNumber]) & _
" WHERE [PalletNumberProductsTable] =" & _
Me![PalletNumberContainerFormComboBox]
CurrentDB.Execute sSQL
On 22 Aug 2004 15:13:20 GMT, R C <rcmail14872@yahoo.com> wrote:
[color=blue]
>I tried to make some SQL code using both if and iif and the code below
>gives the error message "you have entered and operand without an
>operator" and the word "then" is highlighted.
>
>iif ([Products]![PalletNumberProductsTable] =
>Forms![ContainerAssociationForm]![PalletNumberContainerFormComboBox].Aft
>erUpdate then [Products]![ContainerNumberProductsTable] =
>Forms![ContainerAssociationForm]![GETContainerNumber])
>
>
>*** Sent via Developersdex
http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it![/color]
**********************
jackmacMACdonald@telusTELUS.net
remove uppercase letters for true email
http://www.geocities.com/jacksonmacd/ for info on MS Access security