If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Please Help!? Show/Don't show fields
How do I use criteria to show or not show a fiel, for example, I have an IIf
function: IIf([Forms]![FormName]![ComboBox]="Text",([Query].[Fieldname])=True) I would only like to show this field when the criteria is met and block out other criteria. Thank you in advance! -- Regards Ashley Smart |
#2
|
|||
|
|||
Are you saying you want a query to change which fields it includes,
depending on the value on a form? One approach would be to use a SQL statement that you build "on the fly" from the form itself. Regards Jeff Boyce Access MVP "A. Smart" wrote in message ... How do I use criteria to show or not show a fiel, for example, I have an IIf function: IIf([Forms]![FormName]![ComboBox]="Text",([Query].[Fieldname])=True) I would only like to show this field when the criteria is met and block out other criteria. Thank you in advance! -- Regards Ashley Smart |
#3
|
|||
|
|||
Could you give me an example please, I'm not hot on SQL statements!
Cheers -- Regards Ashley Smart "Jeff Boyce" wrote: Are you saying you want a query to change which fields it includes, depending on the value on a form? One approach would be to use a SQL statement that you build "on the fly" from the form itself. Regards Jeff Boyce Access MVP "A. Smart" wrote in message ... How do I use criteria to show or not show a fiel, for example, I have an IIf function: IIf([Forms]![FormName]![ComboBox]="Text",([Query].[Fieldname])=True) I would only like to show this field when the criteria is met and block out other criteria. Thank you in advance! -- Regards Ashley Smart |
#4
|
|||
|
|||
Are you trying to dynamically alter the select list of a query? You can't do
it this way. You can try nested IIFs by using the false option of the IIF statement (IIF (expression, true-value, false-value)) as below: select IIF (Forms!FormName!ComboBox = "text", fieldname1, IIF (Forms!FormName!ComboBox = "text", fieldname2,"") etc. This will work but you're going to drive yourself crazy balancing parentheses if there are too many options (unless you've got a reasonable editor that balances parentheses for you), you need one of these nested IIFs for each option in the combo box, and you've got to remember to change the query if the set of options changes ("text" doesn't have a match- a zombie; or the text changes). It gets really screwy if you have to worry about the ',' field separators, although with a ComboBox you only have a single selection, so you won't have to. Good Luck! -- Chaim "A. Smart" wrote in message ... How do I use criteria to show or not show a fiel, for example, I have an IIf function: IIf([Forms]![FormName]![ComboBox]="Text",([Query].[Fieldname])=True) I would only like to show this field when the criteria is met and block out other criteria. Thank you in advance! -- Regards Ashley Smart |
#5
|
|||
|
|||
Your query is actually a SQL statement, and you can see it by changing the
view of your query in design mode to SQL. A "dynamic" SQL statement would be build in code, behind the form, probably on a command button. You'll need to work in both SQL and in VBA to pull this off. Your SQL statement would be "assembled" by using an If ... Then statement in code to check for the value of the form's control, then include (or not) the reference to the field as part of the SELECT clause -- for example: If Me!chkMyCheckBox = True Then strSQL = strSQL & ", MyQueryField" End If Good luck! Jeff Boyce Access MVP "A. Smart" wrote in message ... Could you give me an example please, I'm not hot on SQL statements! Cheers -- Regards Ashley Smart "Jeff Boyce" wrote: Are you saying you want a query to change which fields it includes, depending on the value on a form? One approach would be to use a SQL statement that you build "on the fly" from the form itself. Regards Jeff Boyce Access MVP "A. Smart" wrote in message ... How do I use criteria to show or not show a fiel, for example, I have an IIf function: IIf([Forms]![FormName]![ComboBox]="Text",([Query].[Fieldname])=True) I would only like to show this field when the criteria is met and block out other criteria. Thank you in advance! -- Regards Ashley Smart |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
use a recordset to determine fields to show | Noemi | Setting Up & Running Reports | 1 | April 10th, 2005 02:14 AM |
Show multiple fields in combo box | Lisa | Using Forms | 3 | April 5th, 2005 10:45 PM |
Link a query to show more fields | Ray | Running & Setting Up Queries | 5 | April 5th, 2005 05:18 AM |
Additional fields for form based parameter query/null fields | geeksdoitbetter | Running & Setting Up Queries | 2 | January 7th, 2005 10:05 PM |
how to show fields when u click a button | mimi | General Discussion | 1 | June 23rd, 2004 09:47 AM |