Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

TextBox ControlSource

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Warrio - 11 Mar 2005 17:11 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.