Page 1 of 2 12 LastLast
Results 1 to 15 of 28
  1. #1
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727

    Bold or Color certain records in split form

    I was wondering if it was possible to bold or color text in a split form based on if certain values are present within that record?

    For example, say the record has 3 text boxes (txtbox1, txtbox2, and txtbox3), if txtbox3 has the value of a certain word like "tree" then txtbox1 will be bold.

    Is this possible in a split form where all the records are showing in a list?

    Thanks.

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Maybe try conditional formatting?
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    Maybe try conditional formatting?
    Hi Gicu!

    Yeah I looked at it a bit but from what I could tell, it seems that it will only allow me to change the text box I select to do the conditional formatting on. I'm not sure how to make one text box change conditions based on another text box's conditions. If that makes sense. Do you know if this is possible? If so, I can try and mess with it more to figure it out.

    Thanks for the reply.

  4. #4
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    Is "tree" the only word in txtbox3 or is tree part of a longer string?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,941
    it seems that it will only allow me to change the text box I select to do the conditional formatting on
    . Not true - select all the controls you want to format then use expression is and a formula such as

    =[txtbox3] like “*tree*”

  6. #6
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Micron View Post
    Is "tree" the only word in txtbox3 or is tree part of a longer string?
    Tree was an example. More accurately it will have a number in front of abbreviations so it needs to be specific. Here are some examples:


    2 SUP/DC
    2 SUP CS1/2
    3 ADMIN

    So the examples above are for txtbox3 values. If txtbox3 has any of those values, I want txtbox1's value to be bold. I should also mention that txtbox3 is a combo box with a list of values. Here are all the values for that box:

    1 USER CS1/2
    1 USER DC
    2 SUP/DC
    2 SUP CS1/2
    3 ADMIN

    So basically only if txtbox3 has the bottom 3 values listed above, I would want txtbox1 to be bold.

  7. #7
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by CJ_London View Post
    . Not true - select all the controls you want to format then use expression is and a formula such as

    =[txtbox3] like “*tree*”
    Thanks. I think I want something more specific than using like. See post #6 as I listed the values involved.

  8. #8
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Try
    If Left ([cboYourCombo],1) In ("2","3")
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  9. #9
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    Try
    If Left ([cboYourCombo],1) In ("2","3")
    Not very good with the expressions so I been trying to use VBA. I put this in the On Current event of the split form and it's not working:

    If Me.combox.Value = "3 Admin" Then
    Me.txtbox1.FontBold = True
    End If

    Do you know why this code doesn't work?

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,570
    Have you walked through the code to see where it goes?
    You have gone from a textbox to a combo now? Do you have Option Explicit at the top of your form?

    You also said
    I should also mention that txtbox3 is a combo box
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #11
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Welshgasman View Post
    Have you walked through the code to see where it goes?
    You have gone from a textbox to a combo now? Do you have Option Explicit at the top of your form?

    You also said [/COLOR]
    Yeah it's split form with a combo box that has a list of values for the user to choose from. The split form shows the whole recordset so I think VBA doesn't quite work the same way as just a regular form because I'm pretty sure if it was a regular form that code I pasted above would probably work with no problems. Basically I just want the split form to show all records that have "3 Admin" for the combo box, make the text box 1's values to be bold. Those are basically the people that have admin rights. If that makes sense.

    So I wrote this:

    If Me.combox.Value = "3 Admin" Then
    Me.txtbox1.FontBold = True
    End If

    in the On Current event of the split form and no records are showing bold for text box 1 which is basically the clerk's name.

  12. #12
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,570
    The code will make the control bold in the one part of the single form, but not the datasheet part.
    I have just tried on a form of mine.

    I started using what I called and Emulated Split Form (ESF) in place of a split form, however tryng to do it on that which is actually a continuous form affects every record despite being bound?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  13. #13
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    As mentioned the Current event won't trigger in the datasheet portion of the split form so conditional formatting would be the only option I can suggest. And keep in mind that the combo's value is based on its bound column not what is displayed (usually the bound column is a numeric ID and hidden).
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  14. #14
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    As mentioned the Current event won't trigger in the datasheet portion of the split form so conditional formatting would be the only option I can suggest. And keep in mind that the combo's value is based on its bound column not what is displayed (usually the bound column is a numeric ID and hidden).
    Cheers,
    Thanks.

    Ok I clicked the combo box on the bottom where the datasheet section is for design view and went to conditional formatting and selected a new rule. I then selected "Expression Is" and pasted this into the field next to it:

    If Left ([cmbSplitUserSecurity],1) In ("2","3")

    I get an error message saying "The expression you entered contains invalid syntax. You may have entered an operand without an operator."

    So then I did the same thing for one of the text boxes that I wanted to be bold, if the combo box contained a certain value (3 ADMIN) and I get the same error message.

    Do I need to add something else to the expression? How does it know to make the other text boxes bold?

    Thanks Gicu.

  15. #15
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    Erroneous statement, apparently, so removed.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Split form and looping within records
    By jaryszek in forum Access
    Replies: 1
    Last Post: 11-13-2017, 05:24 AM
  2. Split form updates all records
    By pbruce66 in forum Forms
    Replies: 2
    Last Post: 01-22-2017, 11:36 AM
  3. back color based on value in split form
    By vicsaccess in forum Programming
    Replies: 5
    Last Post: 12-16-2015, 10:04 PM
  4. Split Form not showing all records
    By Abarency in forum Forms
    Replies: 6
    Last Post: 10-20-2012, 02:54 PM
  5. Filtering records on a split form
    By Accessbeginner23 in forum Programming
    Replies: 1
    Last Post: 07-02-2012, 03:23 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