Hello!!
I have to set (by code) the control source of a textbox and I use the
following code:
myTextBox.ControlSource = "IIf(1=1;'True';False')
the result should be 'True'
but when I run this statement, Access says "The expression you entered
contains invalid syntax"
However, the expression works if I type it (by hand) into the textbox
control
Does anyone knows why I can't do that by code?
Thanks for any suggestion
Brendan Reynolds - 11 Mar 2005 17:23 GMT
Should be more like ...
Me!txtTest.ControlSource = "=IIf(1=1,'True','False')"
... you're missing the '=' in front of the 'IIf', and the apostrophe in
front of 'False'.
Ignore the fact that I'm using commas and you're using semi-colons, that's
not an error, that's just because we're using different international
settings.

Signature
Brendan Reynolds (MVP)
> Hello!!
>
[quoted text clipped - 13 lines]
>
> Thanks for any suggestion
Warrio - 11 Mar 2005 17:29 GMT
Thanks for the help!!
it's great!!
> Should be more like ...
>
[quoted text clipped - 24 lines]
>>
>> Thanks for any suggestion
LWendel - 11 Mar 2005 17:33 GMT
Is the field you are using a True/False field ? If so the code should be 0
for false and -1 for true.
> Hello!!
>
[quoted text clipped - 13 lines]
>
> Thanks for any suggestion