Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2007
    Posts
    40

    Unanswered: Datasheet view column colours?

    Is it possible to change the background colour of an entire column when viewing a form in datasheet view? I would have thought that you would just change the BackColor property of the relevant text box control, but this does not seem to work. I read on the internet about something called "FormatConditions", but in any case I don't think this is relevant because I am not trying to conditionally change the format of a field, I want all the cells to be a different colour. I also tried to use the Format->Conditional Formatting menu item, but this didn't work either, it just changed the BackColor. Obviously this does make a difference in Form view but it does not seem to change the cell background colour in datasheet view.

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    BackGround Colors on a Datasheet

    Perhaps something like this (I used the Format -> Conditional Formatting on the RecID field and OtherNumberField in the subform) which is set to a datasheet view.
    Attached Files Attached Files
    Last edited by pkstormy; 08-12-07 at 15:08.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Jun 2007
    Posts
    40
    Quote Originally Posted by pkstormy
    Perhaps something like this (I used the Format -> Conditional Formatting on the RecID field and OtherNumberField in the subform) which is set to a datasheet view.
    Yes, you are right, thanks very much. This is a bit strange - if you put the colour change in the top box of "Conditional Formatting" (namely, the one which says "Default Formatting") then it does not affect the sheet, but it does affect it if you put it under a condition.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Hmmm. I'll look into this kidburla. I did the example rather quickly.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by kidburla
    Is it possible to change the background colour of an entire column when viewing a form in datasheet view... I also tried to use the Format->Conditional Formatting menu item, but this didn't work either, it just changed the BackColor. Obviously this does make a difference in Form view but it does not seem to change the cell background colour in datasheet view.
    What exactly do you mean when you say "background colour?" The only "background" colors that cells/columns have in Datasheet view are the backcolors of the cells! All other colors in Datasheet view are governed by Windows, just like the colors of scrollbars and the backcolors of command buttons.
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Jun 2007
    Posts
    40
    Quote Originally Posted by Missinglinq
    What exactly do you mean when you say "background colour?" The only "background" colors that cells/columns have in Datasheet view are the backcolors of the cells! All other colors in Datasheet view are governed by Windows, just like the colors of scrollbars and the backcolors of command buttons.
    Yes, I meant the background colours of the cells. I meant, that I was trying to change the backcolor of every cell in a column to some colour, say red. Right now, I am having to do something like this:

    Code:
    txtSomeField.FormatConditions.Add(acFieldValue, acGreaterThanOrEqual, 32768)
    txtSomeField.FormatConditions(txtSomeField.FormatConditions.Count - 1).BackColor = 255
    This is a bit of a hack, but I can't currently see any way around it.

  7. #7
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Datasheets don't really lend themselves to much in the way of formatting, but if the field in question always has something in it, i.e. at least 1 character, Conditional Formatting from the menu will do the job.

    InDesign View:
    Select the cell/column.
    Goto Format - Conditional Formatting
    For Condition1 use the arrow and select Field Has Focus (you have to do this on Condition1; Condition2 and Condition3 doesn't have this option)
    Format background to Red
    Click on Add>>
    For Condition2 select Expression Is.
    In the box enter Len([YourFieldName])>0
    Format background to Red
    Click OK

    This should do it, but I have to tell you that sometimes as you're scrolling it'll take a microsecond before the cell turns red, depending on the speed of your system.

    Good Luck!
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

Posting Permissions

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