Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Micron View Post
    Erroneous statement, apparently, so removed.
    Sorry Micron. What did you mean by this?

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,570
    Quote Originally Posted by data808 View Post
    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.
    See the picture
    Attached Thumbnails Attached Thumbnails Capture.PNG  
    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

  3. #18
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    Upon further examination, what I posted was not correct. You would have seen what that was in the email that the forum sent.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #19
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    @data808: have you managed to get it going? If not can you please show us what you have in the conditional formatting and any errors that you are still getting?
    Make sure the combo's bound column (not the first visible one) returns the values you think it does.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #20
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    @data808: have you managed to get it going? If not can you please show us what you have in the conditional formatting and any errors that you are still getting?
    Make sure the combo's bound column (not the first visible one) returns the values you think it does.
    Cheers,
    Thanks Gicu. Sorry for the delay. I couldn't get it to work. Right now I just have a conditional formatting to color code the actual combo box which basically has 5 different values to choose from in the drop down list. So based on what value is selected will determine what color to highlight and make bold in the combo box for the data sheet section of the split form.

    What I actually want is, based on the value selected for the combo box, make another field which is the user's name to be highlighted in a specific color and bold instead of the combo box itself. Basically the combo box shows the user security level such as clerk, supervisor, or admin for example. So if the record has "supervisor" selected for the combo box value then make that user's name field be highlighted yellow and bold. If the combo box is admin, then make the user's name field be red and bold.

    It's just a way to draw attention to users with special permissions. Is this possible to do?

    Thanks.

  6. #21
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    It should be possible with conditional formatting as you can reference another field in the record in the expressions for formatting, what have you tried?
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #22
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    It should be possible with conditional formatting as you can reference another field in the record in the expressions for formatting, what have you tried?
    Cheers,
    Based on the picture provided by Welshgasman in Post #17 here is what I tried so far:

    I did conditional formatting on both the combo box and the employee fields using "Expression Is".

    The expressions I've tested is this:

    Left([cmbSplitUserSecurity],5) In ("txtSplitEmpName","3 ADMIN")
    Left([txtSplitEmpName],5) In ("cmbSplitUserSecurity","3 ADMIN")

    with no luck. Nothing happens. For testing I just set it to bold for these expressions with no highlighting for now. Just wanted to see if it would work. So not sure if I am reading it wrong but the original expression example that Welshgasman provided in the photo was this:

    Left([Field2],5) In ("Field","Test")

    The "Fields" in this expression made me think that, that is where the name of the combo box and employee name field needs to go and the "Test" was the value of the combo box. Is that not correct?

  8. #23
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,941
    Code:
    Left([cmbSplitUserSecurity],5) In ("txtSplitEmpName","3 ADMIN")
    if txtSplitEmpName is the name of a control, it needs to be in square brackets.

    If it is not, the how do you expect a 3 character value to equal a string which is a different length?

    you are using the first 5 characters of
    cmbSplitUserSecurity, so you can only have 5 characters for the 'in' part

    Left([cmbSplitUserSecurity],5) In ("txtSp","3 ADM")

  9. #24
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    In post #8 I gave you an expression to try, have you tried that?

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

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  10. #25
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    In post #8 I gave you an expression to try, have you tried that?

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

    Cheers,
    Yeah tried that and I get invalid syntax error that says:

    The expression you entered contains invalid syntax. You may have entered an operand without an operator.

    Also I'm not sure if this conditional formatting needs to be with the txtSplitEmpName or the cmbSplitUserSecurity.

    Update: I just tried it again and it worked! I remember trying it back when you first suggested it in post #8 and got that same syntax error so I gave up on it cause I wasn't sure if I was using it correctly. So when I tried it again just now to give you an explanation of what happens, it gave that same syntax error but after I wrote that I'm not sure if the conditional formatting needs to be with the employee field or the combo box in this post, I went and tried it one more time on the employee field and it worked. So not sure what I was doing wrong for it to cause the syntax error but its working fine now.

    Thanks Gicu for all your expertise! Appreciate it.

  11. #26
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    That sort of expression has to equate to something; i.e. you must assign the value it returns to something, be that a variable, object or perhaps (although maybe not in this case) a property. You probably fixed it by assigning the return value of left function to an unbound control (thus its default property, which is .Value) or a bound control (thus the field (object) it is bound to).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  12. #27
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Glad to hear you got it going, can't remember how many times I tried things and weren't working and then ..bingo, it worked....

    @Micron: the expression was to be used in the conditional formatting wizard in the text box(es) (txtSplitEmpName and I think others) to be formatted based on the values in another field (the combo named cmbSplitUserSecurity).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  13. #28
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    Glad to hear you got it going, can't remember how many times I tried things and weren't working and then ..bingo, it worked....

    @Micron: the expression was to be used in the conditional formatting wizard in the text box(es) (txtSplitEmpName and I think others) to be formatted based on the values in another field (the combo named cmbSplitUserSecurity).

    Cheers,
    I realized the two suggestions you offered were slightly different. In post #8 you gave this:

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

    Then in post #24 you gave this:

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

    So maybe the "If" is what caused the syntax error since post #24 is the one that worked. Just my guess though. Thanks again @Gicu.

Page 2 of 2 FirstFirst 12
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