Results 1 to 10 of 10
  1. #1
    hawkins is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    82

    Conditional text box for two fields


    I have text boxes that combine two fields into one, for example the control source is =IIf(IsNull([BuckC])=True And IsNull([BoostC])=True,"",[BuckC] & " , " & [BoostC]) . For simple its just =[Buckc] + ": "+[BoostC]. I am trying to set a condition that if one of them exceeds a certain number the background color will change to yellow. I know how to do this if its only for one field but I am wondering if it is possible to do it with multiple fields?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Sure, you just use Expression Is. For instance a condition might be:

    [Field1] > 10 OR [Field2] > 10
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    hawkins is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    82
    For some reason, I enter in for example, [BuckA]>10 Or [BoostA]>10 into the expression is and fill the background with yellow but when I go to print preview if they are greater than 10 it doesnt fill the background with yellow. It will go bold if it meets the criteria but not the background color to yellow. Any hints?

    Answer Solved: I had to set the fill background in the design tab to automatic instead of empty.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    If it will do bold it's not a problem with the condition. Make sure the back style of the textbox isn't transparent.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    hawkins is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    82
    ok sweet, got it to work! Say I have two conditions, one of a range from 11 to 13 which filles with yellow and another range of greater than 14 which fills with red. There are two fields in the record source : = [BuckA] + ":" + [BoostA]. The conditions stand for both fields but I was wondering if 1 field is in the 11-13 range and another is in the +14 how to set priority to the field that is in the red? Would that just be another expression?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Sounds like it, yes. In 2007 you can have 3 conditions, and they're processed in order, so the first one that evaluates to True will be the applied format.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    hawkins is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    82
    ok that was exactly what my problem was. Sorry with these consecutive questions but I am trying to figure out the easier ones first then go on to the harder ones. I have a group of 3 fields that I need to find the minimum and maximum of those 3 then do the calculation; ((Max-Min)/Max)*100. I was wondering if I should do this in the conditional area or make a query to do the calculations and then base the condition on that value? If you'd say the query, how would i find the minimum and maximum values in the same record. The three values' header column names are AmpsA, AmpsB, and AmpsC. Thank you for all your help so far!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Access doesn't really have a function to get min/max across fields, as normalized data isn't stored that way. You can use functions like these:

    http://support.microsoft.com/default...b;en-us;209857

    I'd probably do it in the query, but it may work in CF.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    hawkins is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    82
    thanks for all your help! I ended up just making a new column and using iif functions

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Not the way I would have gone, but glad you found a solution that works for you.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Using Caluculated fields to return text
    By InsaneJammer in forum Access
    Replies: 8
    Last Post: 04-08-2011, 07:52 AM
  2. OLE and Text Fields with MS Word
    By WBlohm in forum Access
    Replies: 1
    Last Post: 09-10-2010, 07:53 AM
  3. Replies: 0
    Last Post: 11-13-2009, 10:18 AM
  4. fields of type text
    By ashiers in forum Forms
    Replies: 0
    Last Post: 11-28-2008, 10:52 AM
  5. Split text field into two text fields
    By Grant in forum Access
    Replies: 6
    Last Post: 01-31-2008, 05:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums