Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More than 1 IIf statement 1

Status
Not open for further replies.

Quan9r

Technical User
May 18, 2000
36
0
0
US
I have an unbound text box with the following IIf statement
=IIf([Check132]=Yes,"UNCONTROLLED")

I have additional check boxes and statements that I would like to fill that unbound text box with - dependant upon which box is checked -
How do you add more than 1 IIf statement? I tried and "Or" but that just gave me an error message.
 
Hmmm, I would recommend using a select case statement instead. You can put your code in the on_change or on_click event of your checkbox option group.

Select Case <checkboxnamehere>
Case 1
me!textbox = &quot;whatever&quot;
Case 2
me!textbox = &quot;something&quot;
etc
End Select Maq B-)
<insert witty signature here>
 
=IIf([Check132]=Yes,&quot;CONTROLLED&quot;,&quot;UNCONTROLLED&quot;)

Aivars

 
This is the Data Source for my text box txtCombinedComment:

=IIf([TitleInsuranceOK]=&quot;OK&quot; Or [TitleInsuranceOK]=&quot;N/A&quot;,&quot;&quot;,&quot;TI: &quot; & [TitleInsuranceComment]) & IIf([NoteOK]=&quot;OK&quot; Or [NoteOK]=&quot;N/A&quot;,&quot;&quot;,CRLF() & &quot;Note: &quot; & [NoteComment]) & IIf([DeedOK]=&quot;OK&quot; Or [DeedOK]=&quot;N/A&quot;,&quot;&quot;,CRLF() & &quot;Deed: &quot; & [DeedComment]) & IIf([ZOK]=&quot;OK&quot; Or [ZOK]=&quot;N/A&quot;,&quot;&quot;,CRLF() & &quot;Z: &quot; & [RFNComment]) & IIf([RFNOK]=&quot;OK&quot; Or [RFNOK]=&quot;N/A&quot;,&quot;&quot;,CRLF() & &quot;RFN: &quot; & [RFNComment]) & IIf([2924eOK]=&quot;OK&quot; Or [2924eOK]=&quot;N/A&quot;,&quot;&quot;,CRLF() & &quot;2924e: &quot; & [2924eComment]) & IIf([TaxServiceOK]=&quot;OK&quot; Or [TaxServiceOK]=&quot;N/A&quot;,&quot;&quot;,CRLF() & &quot;TaxService: &quot; & [TaxServiceComment]) & IIf([FireOK]=&quot;OK&quot; Or [FireOK]=&quot;N/A&quot;,&quot;&quot;,CRLF() & &quot;Fire Insurance: &quot; & [FireInsuranceComment]) & IIf([CreditReportOK]=&quot;OK&quot; Or [CreditReportOK]=&quot;N/A&quot;,&quot;&quot;,CRLF() & &quot;Credit Report: &quot; & [CreditReportComment]) & IIf([ReceivedOddDaysInterestOK]=&quot;OK&quot; Or [ReceivedOddDaysInterestOK]=&quot;N/A&quot;,&quot;&quot;,CRLF() & &quot;Odd Days Interest: &quot; & [ReceivedOddDaysInterestComment])

Moreover, it works! Tom Budlong
TomBudlong@Bigfoot.com

 
The following is untested, but hopefully it'll hit fairly close to home. I'll give you bits and pieces and let you enjoy the thrill of taking it from there.

It appears you've got the following nine check-boxes:

TitleInsuranceOK
NoteOK
DeedOK
RFNOK
2924eOK
TaxServiceOK
FireOK
CreditReportOK
ReceivedOddDaysInterestOK

A checked box, indicating &quot;OK&quot;, would translate as True (-1); an unchecked box, indicating &quot;Not OK&quot; would translate as False (0). In addition to True and False, you've specified a third state (&quot;N/A&quot;)

Check-boxes, toggle buttons and option buttons, if not within an option group (NOTE: It doesn't work within option groups), have a 'TripleState' property which, if turned-on, allow a third option in which the check-box will appear 'grayed-out' and its value will be Null. This you can use as your &quot;N/A&quot; status. Before going further, look up TripleState Property in Access Help to get an overview.

Your code appears to use similar logic throughout, i.e., if the situation is either &quot;OK&quot; (-1) or &quot;N/A&quot; (Null) then do something. Using the TripleState property, you could restate this as: If the check-box <> 0 (false), then do something.

Here are some potential components (partial list) of your text box.

My1 = &quot;TI: &quot; & [TitleInsuranceComment])
My2 = &quot;Note: &quot; & [NoteComment])
My3 = &quot;Deed: &quot; & [DeedComment])
My4 = &quot;Z: &quot; & [RFNComment])

Lookup the Tag property to see how this could be helpful in selecting a specific group of controls to process.

Please give it some thought and effort and then post back with your problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top