IIF statement in SQL, .isvisible then

Hello,

Is there are way to check for visibility on a control before running the criteria:

IIF Forms!myfrm!drivers.visible THEN Forms!myfrm!myfield
Ernest GroggSecurity Management InfoSecAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
Where are you trying to do this?

Your THEN statement is incomplete.  Are you trying to do something like:

SomeValue = IIF(Forms!myfrm!drivers.visible, True Expression, False Expression)

If not, what are you actually trying to accomplish?
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
IF Forms!myfrm!drivers.visible = True THEN Forms!myfrm!myfield <SomeThingHere>
0
Ernest GroggSecurity Management InfoSecAuthor Commented:
On my subform I have it set up running on a sql statement that will save the data based on the main form, but one of the controls are visible and not visible based on the criteria on the main form.  So I set the sql statement to qry the data based on the main form.  

So if the one control is not visible then I want the data not to do the criteria for that control and vice versa....if the control is visible then run the criteria for the control..
0
PatHartmanCommented:
I'm not sure you can refer to any control property except the default one which is .value from SQL.  Remember SQL isn't VBA.  You could create a function that checks the property and returns true or false but this will only be useful if your BE is Jet/ACE.  You should not use VBA or UDF functions in WHERE clauses if the BE is SQL Server since they will prevent Access from passing through the query to the server and instead, Access will request that the entire table be downloaded to the local PC so Access can apply the WHERE clause locally.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ernest GroggSecurity Management InfoSecAuthor Commented:
Ok, so doesn't look good, so i changed the format of the main form to show an ID field after the controls were updated and selected, then I am running the sql criteria on subform.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.