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

Easy IIF syntax question 3

Status
Not open for further replies.

Emblem1

Technical User
Jan 11, 2007
77
US
What is the correct syntax for this?

IIf(Me.Sign1Type = "Case Sign" Or Me.Sign1Type = "Street Name Sign", Me.CSign1.Locked = False, Me.CSign1.Locked = True)

I want to lock the combo box CSign1 if Sign1Type is NOT "Case Sign" or "Street Name Sign".

Thanks.
 
It's more like:
Code:
Me.CSign1.Locked = IIf(Me.Sign1Type = "Case Sign" Or Me.Sign1Type = "Street Name Sign", False, True)
Hope this helps

HarleyQuinn
---------------------------------
Black coat, white shoes, black hat, cadillac. The boy's a timebomb!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before post
 



Hi,
Code:
If Me.Sign1Type = "Case Sign" Or Me.Sign1Type = "Street Name Sign" Then
   Me.CSign1.Locked = False
Else
  Me.CSign1.Locked = True
End If


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Glad to help, thanks for the star [smile]

HarleyQuinn
---------------------------------
Black coat, white shoes, black hat, cadillac. The boy's a timebomb!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before post
 
Me!CSign1.Locked = (Me!Sign1Type <> "Case Sign" And Me!Sign1Type <> "Street Name Sign")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Not to rain on the parade but I see a couple possible issues that I would question:
[li] Values are hard-coded into expressions. Are the sign types ever going to change or others need to lock a control? If so, you should be maintaining data, not code[/li]
[li] The use of "CSign1" and "Sign1Type" suggests there might be "CSign2" and "Sign2Type" or "CSign3" and "Sign3Type". If this is true, then I expect your table structure might not be normalized.[/li]

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top