• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1197
  • Last Modified:

Forms: Conditional Formatting (when field Is Not Null) on Tab Stop

Is there a way to put an IIF statement in conditional formatting that would essentially say...

If field IS Not Null, then Control.TabStop = False on a form?

Thanks!
Matt
0
Matt330
Asked:
Matt330
  • 7
  • 7
  • 2
  • +1
1 Solution
 
rockiroadsCommented:
Have u doing it via the menu option

Format/Conditional Formatting
0
 
Matt330Author Commented:
THanks, yeah - I just don't know how to write the IIf statement.  
0
 
rockiroadsCommented:
syntax for IIF is


IIF (field is not null, do this, otherwise do that)

0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
mbizupCommented:
Is Tabstop an option in conditional formatting?  Maybe this in your form's current event:

YourControl.TabStop = IIf (NZ(YourControl,"")= "", TRUE,FALSE)
0
 
Matt330Author Commented:
=IIF ([Day 0] Is not Null, Control.TabStop = False)

results in the error "You have entered a comma without a preceding value"
0
 
Matt330Author Commented:
mbizup - your suggestion is definately right, there's just something a little strange happening.

My intent is to move the tab to the first blank field for data entry.  The "oncurrent event" now looks like:


Private Sub Form_Current()
[Day 0].TabStop = IIf(Nz([Day 0], "") = "", True, False)
[Day 30].TabStop = IIf(Nz([Day 30], "") = "", True, False)
[Day 60].TabStop = IIf(Nz([Day 60], "") = "", True, False)
[Day 90].TabStop = IIf(Nz([Day 90], "") = "", True, False)
[Day 120].TabStop = IIf(Nz([Day 120], "") = "", True, False)
[Day 150].TabStop = IIf(Nz([Day 150], "") = "", True, False)
End Sub

It really wants to perform correctly, but the Tab will arbitrarily land on a field that has data in it, though it's a heck of a lot better than tabbing through every single entry.

Any ideas why?
0
 
Matt330Author Commented:
Okay - I figured out a long way around for now.  One follow-up.  Can I add an "Or" clause to that?

If [DAy 0] Is Null OR background color is Grey tabstop = No
0
 
mbizupCommented:
Are you referring to the background color of the control?

[Day 0].TabStop = IIf(Nz([Day 0] OR [Day 0].BackgoundColor = YourColor, "") = "", True, False)
0
 
mbizupCommented:
Sorry...That was a really bad post.  It should look like this:

[Day 0].TabStop = IIf(Nz([Day 0] , "") = ""  OR [Day 0].BackgoundColor = YourColor, True, False)
0
 
Matt330Author Commented:
You da man - I promise this is the last question - How do I get the "hex?" key for the background color.  I obviously can't put "Backroundcolor = Grey, "".
0
 
mbizupCommented:
How are you setting the background color?  Does it not show up in the properties of the control?  I know there are codes like vbBlue, etc... vbGrey does not appear to be one of them...

This is a chart of hex numbers for different colors:
http://www.web-source.net/216_color_chart.htm

>You da man
I'm not da man.
Check my profile:
http://www.experts-exchange.com/M_3506698.html

0
 
mbizupCommented:
Are you setting the color through conditional formatting where the color numbers are not apparent?  There are only a few Greyish options there.  There is probably a better way of doing this, but you could try setting the backgound color of a "test" textbox to match, and reading the number from the BackColor (not BackgroundColor like I'd posted earlier)  property of the control.  The Greyish colors I came up with are:

Light Grey:  12632256
Darker Grey: 8421504
Brownish Grey: 12615808

So for light grey:

[Day 0].TabStop = IIf(Nz([Day 0] , "") = ""  OR [Day 0].BackColor = 12632256, True, False)
0
 
Matt330Author Commented:
Dude - your just full of good ideas.

Thanks brotherman!!
0
 
mbizupCommented:
>Thanks brotherman!!
Dude,
I'm a sisterwoman.  :-)
0
 
Matt330Author Commented:
Thanks BabyDoll!! (seriously, thanks.)
0
 
mbizupCommented:
lol! Glad to help.
0
 
flavoCommented:
:-O
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 7
  • 7
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now