Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2009
    Posts
    89

    Unanswered: Format Field colour in datasheet on Split form ?

    Hi. Ive got a split form and I want to change the colour of some of the fields. With some fields I have done this using :
    Code:
    #,##0.00;-#,##0.00[Red];0.00[Green]
    In the "format" property however I do not see how to do this for a textbox with just text.

    how would I do this?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Based on the condition you want, use this in the Current event of the form and/or in the AfterUpdate event of the Textbox:
    Code:
    If <Something> Then
        Me.TextBox_X.BackColor = <ColourCode1>
    Else
        Me.TextBox_X.BackColor = <ColourCode2>
    End If
    Have a nice day!

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    You might also try Conditional Formatting. Assuming you have 2002 or later (I believe) it is in the Format menu.

  4. #4
    Join Date
    Jun 2009
    Posts
    89
    thanks but it;s the font colour I want to change, not the back colour (as this will ruin the coloured rows).

    conditional formatting doesn't seem to work on fields in a datasheet within a split form (hence why i'm using that code above in the format property).

    this must be possible! (access 2007 if it makes a differnece).

  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Quote Originally Posted by DCKunkle View Post
    You might also try Conditional Formatting. Assuming you have 2002 or later (I believe) it is in the Format menu.
    I agree, and it was available in 2000.
    Paul

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Just tested Conditional Formatting on a split form in 2007, and it worked fine.
    Paul

  7. #7
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I reported the idiot rictBoittee as a spammer.
    Paul

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You cannot do this in code for a Datasheet View form (or for a Continuous View form) as it will change all instances of the control,i.e. it will change the formatting for that control on all records. You'll have to use Conditional Formatting, as Paul suggested.

    Also, the Format Property of a textbox cannot be used to format things like forecolors.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  9. #9
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Quote Originally Posted by Missinglinq View Post
    Also, the Format Property of a textbox cannot be used to format things like forecolors.
    You may want to clarify, as the technique noted by rudeboymcc in the first post can be used to change the forecolor.
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •