• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

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
0
Ernest Grogg
Asked:
Ernest Grogg
2 Solutions
 
Dale FyeCommented:
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 ArchitectCommented:
IF Forms!myfrm!drivers.visible = True THEN Forms!myfrm!myfield <SomeThingHere>
0
 
Ernest GroggAuthor 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
 
Ernest GroggAuthor 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now