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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple IIf statement Problem involving multiple combo boxes

Status
Not open for further replies.

robbro

Technical User
Mar 26, 2003
5
0
0
US
What I want to do is this:
On my form, (only one exists) when any one of the 3 combo boxes (each is referanced to a value list) are updated (On Update) I want another box to automatically update.

I've placed this event procedure into the "On Update" property of each box:

=IIf(([Equip Review Status]=("N/A" Or "Accepted")) And ([Formu Review Status]=("N/A" Or "Accepted")) And ([Mat Review Status]=("N/A" Or "Accepted")),[Preliminary Design Review Status]="Reviewed",[Preliminary Design Review Status]="Not Reviewed")

What's wrong with this. Im trying to say, "if all 3 are identified as "Accepted" or "N/A" the Review Status is "Reviewed", otherwise the Review Status is "Not Reviewed".

On update, i get a Type Mismatch error.

Thank you for any help,

Rob
 
Rob

The Type Mismatch error suggests to me that your [Preliminary Design Review Status] is not expecting a string value. If it's a combo box, have you an index column and therefore need to set the value as 0,1,2 etc?

Just for clarity and ease of maintenance, I would also set each of your AfterUpdate events to an Event Procedure which calls a function performing your IIF checks (with an IF obviously).


Steve
 
Unfortunately, the way you're using the OR in the conditions is not quite valid, although I'm sure we all wish it were:
You cannot ask
Code:
[Equip Review Status]=("N/A" Or "Accepted")
you must ask
Code:
[Equip Review Status] = "N/A" OR [Equip Review Status]="Accepted"
and adjust all of the parens to match.
As an alternative, I offer the following, which may be much easier to read:
Code:
Status = "Not Reviewed"
Select Case [Equip Review Status]
   Case "N/A", "Accepted"
      Select Case [Formu Review Status]
         Case "N/A", "Accepted"
            Select Case [Mat Review Status]
               Case "N/A", "Accepted"
                   Status = "Reviewed"
            End Select
      End Select
End Select
If may also be faster in that as soon as any one of the three conditions fail, you'll drop out, rather then comparing all three entries twice every time.

Side Note: If Formu in the middle case correctly spelled?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top