1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Changing Text Colour in An Access Sub Form

Discussion in 'Business Applications' started by Philb42, Nov 3, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. Philb42

    Philb42 Thread Starter

    Joined:
    Jul 24, 2008
    Messages:
    18
    I am using Access 2003 and would like to be able to change the text colour of one field in a sub form according to the content of another field. Does anyone know of any code that would allow me to do this?
     
  2. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    The code is available, but does not work on a Subform in Continuous Form Mode.
     
  3. Philb42

    Philb42 Thread Starter

    Joined:
    Jul 24, 2008
    Messages:
    18
    Thanks for your prompt reply. I may change tack and see if I can do it in a List on a Form. Does that make it any easier?
     
  4. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    If the subform is a normal Single Form the VBA is quite simple, it goes in the first field's After Update Event Procedure and looks like this.
    me.subfromname.fieldname.forecolor = number of chosen colour.
    Where subformname is the name of the subform, fieldname is the name of the field to change the colour and the number is the number that you can get from the colour palette.
     
  5. Philb42

    Philb42 Thread Starter

    Joined:
    Jul 24, 2008
    Messages:
    18
    Thanks for your patience. I have now changed my design completely and have a ListBox derived from a query and would like to display the colour of the text in each line depending on one of the fields in the line. Is it possible?
     
  6. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    Phil, I would need to see it to be sure.
     
  7. Philb42

    Philb42 Thread Starter

    Joined:
    Jul 24, 2008
    Messages:
    18
    How do we go about that?
     
  8. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    You can post a zipped copy on here or email it to me.
     
  9. Philb42

    Philb42 Thread Starter

    Joined:
    Jul 24, 2008
    Messages:
    18
    Thanks very much for your offer to help. I have posted a very cut down part of the programme but enough to show you what I want to do.
     
  10. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    Phil, there doesn't appear to be an attachment.
     
  11. Philb42

    Philb42 Thread Starter

    Joined:
    Jul 24, 2008
    Messages:
    18
    I was afraid of that. I'll have another try ASAP
     
  12. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    Phil, if you want to email me a copy I can Private Mail you my email address.
     
  13. Philb42

    Philb42 Thread Starter

    Joined:
    Jul 24, 2008
    Messages:
    18
    If this fails I will email it to you. I have just seen that at 776kb my file exceeds the limit so it will have to be email.
     
  14. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/765636

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice