Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54

    *pic* Conditional Formatting to change Other Field Bold

    Please see attached screenshot.



    In the case below, depending on what is in the "WC" field, I would like for it to BOLD those same characters in the "Remaining Operations" field.

    Any help would be appreciated guys, thank you!

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    you can't format part of a string, however, if that string is ALWAYS going to appear in the same part of your string (positions 3 through 5) then you can rig something up to make it look the way you want.

    If the string can appear anywhere in that long field then it's a bit uglier but it can still be done, however, it the spacing will not look right.

    The basic gist is that you'd have to break up your string into substrings using the left(string, length), mid (string, starting position, length) and right(string, length) functions.

  3. #3
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54
    Looks like this one will be way over my head...

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    it's not that hard, you just have to say know whether or not that same string will appear in the same position every time or not, even if it doesn't there are solutions but I'd sort of have to know if the code you've shown is the ONLY code that needs a partial bold or if there are other codes and whether or not the string can appear anywhere in the longer string or not.

  5. #5
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54
    Thank you for your help rpeare,

    To answer your questions:

    -The same string will not appear in the same position every time. The "remaining" operations field will always be a different length and have multiple combinations of letters/operations.

    -The "WC" field can appear anywhere in the longer string "remaining operations"

    -The "WC" lettering (in this case SRC), is the only thing that needs to be bold on the "remaining operations" field.

    -If "WC" lettering said EDC, EDC would need to be bold on the long string.

    Thank you again for your help.

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    hrm Would it serve your purpose if the string in your WC field appeared in the remaining operations field had a YES or a checkbox with a check in it appear on your report rather than having to bold the string itself? Is it allowable to re-arrange the remaining operations string so that the text in the WC field appears first followed by everything else?

  7. #7
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54
    Your second suggestion would be the ultimate solution!

    If the text int he WC field appeared first followed by everything else, that would be better than bolding it!!

    Is it possible?

    Thanks again!!

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Ok, I made a table called tblTest

    In it I had two fields

    WC
    RemainingOperations

    Note there are no spaces in the field names.

    I built the query below, I've left in a lot of fields in there just to try and make it easier for you to see how I built the final string.

    If you build this string in your query you can display it instead of your remainingoperations field on your report

    Code:
    SELECT tblTest.WC, tblTest.RemainingOperations, InStr([remainingoperations],[wc]) AS StartString, IIf(InStr([remainingoperations],[wc])=0,0,IIf(InStr(InStr([remainingoperations],[wc]),[remainingoperations],"-")=0,Len([remainingoperations]),InStr(InStr([remainingoperations],[wc]),[remainingoperations],"-"))) AS EndString, Mid([remainingoperations],[startstring],[endstring]-[startstring]+1) & IIf(Right(Mid([remainingoperations],[startstring],[endstring]-[startstring]+1),1)<>"-","-",Null) AS StartPart, IIf(Len([remainingoperations])=[endstring],Left(IIf([startstring]<=1,Null,IIf(Len(Left([remainingoperations],[startstring]-1))=[endstring],"XXX",Left([remainingoperations],[startstring]-1))),Len(IIf([startstring]<=1,Null,IIf(Len(Left([remainingoperations],[startstring]-1))=[endstring],"XXX",Left([remainingoperations],[startstring]-1))))-1),IIf([startstring]<=1,Null,IIf(Len(Left([remainingoperations],[startstring]-1))=[endstring],"XXX",Left([remainingoperations],[startstring]-1)))) AS LeftPart, IIf([endstring]<>Len([remainingoperations]),Right([remainingoperations],Len([remainingoperations])-[endstring]),Null) AS RightPart, IIf([startstring]<=1,[remainingoperations],Mid([remainingoperations],[startstring],[endstring]-[startstring]+1) & IIf(Right(Mid([remainingoperations],[startstring],[endstring]-[startstring]+1),1)<>"-","-",Null) & IIf(Len([remainingoperations])=[endstring],Left(IIf([startstring]<=1,Null,IIf(Len(Left([remainingoperations],[startstring]-1))=[endstring],"XXX",Left([remainingoperations],[startstring]-1))),Len(IIf([startstring]<=1,Null,IIf(Len(Left([remainingoperations],[startstring]-1))=[endstring],"XXX",Left([remainingoperations],[startstring]-1))))-1),IIf([startstring]<=1,Null,IIf(Len(Left([remainingoperations],[startstring]-1))=[endstring],"XXX",Left([remainingoperations],[startstring]-1)))) & IIf([endstring]<>Len([remainingoperations]),Right([remainingoperations],Len([remainingoperations])-[endstring]),Null)) AS ROConv
    FROM tblTest

  9. #9
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54
    You sir, are the best!

    Your query works great, the "RightPart" is just about exactly what I need, except it doesn't pull the original "WC" to the front. From what it looks like, you were trying to attempt this with the ROConv Field?

    I see it will put the WC in front, but the ROConv is the entire "RemainingOperations" field.

    Did you have to write all of that code by hand?

  10. #10
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I'm not following you.

    In the testing I ran if the string that's in WC is also in RemainingOperations that string is put at the front, from there it figures out what was to the right of the string and adds that second, then if figures out what was to the left of the string and adds that so the net result, again in my testing, is that you have the entire original string, it's just rearranged so that the WC string is at the start of the field

  11. #11
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54
    Oh, okay.

    And it does just that, you are right!

    Would there be a way to have it re-arrange to add the WC string at the start of the "Right Part" field? This would make everything perfect!

    Everyone from here at work thanks you good sir. Everyone is very much appreciative of your efforts, we can't thank you enough!

  12. #12
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Why do you need to add the string to the right part when the full string gives you what you want? You could do it just by changing the formula to be

    Right Part: [WC] & "-" & <existing formula for right part>

    Stumped as to why you'd only want a partial string when the full string works.

  13. #13
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54
    Rpeare, thanks again, What more do I need to add to the code so the #Error does not appear if WC is null?

  14. #14
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    iif(isnull([wc]), null, [WC] & "-") & <existing formula for right part>

  15. #15
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54
    Hmm, tried it, still giving me the #Error

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Conditional formatting
    By avarusbrightfyre in forum Forms
    Replies: 3
    Last Post: 07-01-2011, 11:18 AM
  2. Bold Field by Cursor Position
    By Rawb in forum Forms
    Replies: 4
    Last Post: 02-08-2011, 08:03 AM
  3. Conditional Formatting
    By Desstro in forum Programming
    Replies: 3
    Last Post: 12-01-2010, 09:52 PM
  4. conditional formatting right(..)
    By bbeernaert in forum Access
    Replies: 3
    Last Post: 08-25-2010, 12:33 AM
  5. Conditional Formatting
    By DanOzDirect in forum Reports
    Replies: 3
    Last Post: 07-21-2010, 08:49 PM

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