Re: Display control dependant on contents of another control

Tech-Archive recommends: Speed Up your PC by fixing your registry



Allen,

Would you please explain to me why I should use the code you provided me
with (which works great) instead of doing it with an IIF statement (which
also works)? I'm just trying to learn better ways of doing things.

Thanks,

Darhl


"Darhl Thomason" <darhlt@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:OC%23Mh5L6FHA.3592@xxxxxxxxxxxxxxxxxxxxxxx
> Thanks Allen,
>
> I've gotta learn that IIF better. It seems like it's a type of if/then
> you can use on txt controls.
>
> I changed the control source of the txt box to:
> =IIf([txtProcessor]="Buypass","ID = " & Mid([Merch#],5,6),Null)
>
> Thanks again for your help!
>
> Darhl
>
>
> "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
> news:ugdUUyB6FHA.3388@xxxxxxxxxxxxxxxxxxxxxxx
>> So, you want to show the txtBuypassID field on a report, only when
>> txtProcessor contains the word "Buypass".
>>
>> Simplest thing is to add a text box to the report, and set its Control
>> Source to:
>> =IIf([txtProcessor] = "Buypass", [txtBuyPassID], Null)
>>
>> If you need to hide the label associated with that text box also,
>> right-click it and choose Change To | Text Box. Then set the Control
>> Source of this text box to:
>> =IIf([txtBuyPassID] Is Null, Null, "Whatever label you want")
>>
>> It is possible to do this with the Format event of the (Detail?) Section
>> of the report, but that is way slower using the IIf() expression. It is
>> also possible to fudge it with Conditional Formatting (hiding via white
>> text on a white background), but again the simple IIf() is better.
>>
>> If you end up with #Error in your text box, and the expression is
>> correct, make sure the text box Name is not the same as the name of one
>> of the fields in the report's RecordSource.
>>
>> --
>> Allen Browne - Microsoft MVP. Perth, Western Australia.
>> Tips for Access users - http://allenbrowne.com/tips.html
>> Reply to group, rather than allenbrowne at mvps dot org.
>>
>> "Darhl Thomason" <darhlt@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:ukHY48A6FHA.3760@xxxxxxxxxxxxxxxxxxxxxxx
>>> Thanks Allen! That did the trick. Now, can this be adapted to a
>>> report?
>>>
>>> Thanks again,
>>>
>>> Darhl
>>
>>
>
>


.



Relevant Pages

  • Re: Null values and calculations
    ... You can use the IIf() expression in the Control Source of a text box. ... another cause of #Error is calculated expressions when the report has no records. ... >> messages where this formaul was being used in a calculations. ...
    (microsoft.public.access.reports)
  • Re: Using the IsError Function
    ... On a report, may refer to a control. ... A control may be missing if a section is missing: ... The VBA IIF is slightly different from the Jet SQL IIF. ...
    (microsoft.public.access.reports)
  • Re: How do I use the IIF expression
    ... ControlSource property of an unbound textbox control on a form (or a ... the If *statement* is used in VBA code, behind a form or report, to ... if you're wanting to display or hide a control ... if you prefer to use the IIf() function in a textbox control's ...
    (microsoft.public.access.gettingstarted)
  • IIf function not producing desired results
    ... their values from the query that the report is based upon. ... The "Games Played" control receives it's value from three IIf ...
    (microsoft.public.access.reports)
  • Re: Help with pending requests
    ... I don't believe you are assigning a new value using that IIF() statement. ... I strongly suspect that the reason why the control on the form doesn't allow ... is Pending (Pending: ... The short date format is in the form in txtRcvdDate. ...
    (microsoft.public.access.formscoding)