Results 1 to 11 of 11
  1. #1
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    Toronto, Ontario, Canada
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Field Color (2002)

    I am making a text field a different color by going to Design View -> Format text box -> &[ Red]. Everything works fine.
    My friend is doing the exact same thing, and it is not working. The field is a text field, and it is not related to any other fields.
    Any ideas?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Field Color (2002)

    It should work, but why don't you just set the ForeColor property? The Format property offers only a few colors (8 or so), the ForeColor millions of them...

  3. #3
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    Toronto, Ontario, Canada
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field Color (2002)

    The forecolour property sets all the field colours.
    I just want the one field to be a different colour.

  4. #4
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field Color (2002)

    Huh?? ... Just set the forecolor property of the text box itself... We are talking about a text box on a form or report right?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Field Color (2002)

    Perhaps we're talking at cross purposes. Where are you trying to set the colour for a field?
    - In a table
    - In a query
    - In a form in datasheet view
    - In a form in single form view
    - In a form in continuous form view
    - In a report

  6. #6
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    Toronto, Ontario, Canada
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field Color (2002)

    Sorry, I should have been more specific.
    In a table.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Field Color (2002)

    I don't know why &<!t>[Red]<!/t> wouldn't work in a table - it should. But in general, it's fairly useless to set color formatting in a table. In a serious database, you don't want end users to open tables or queries directly, they should always view and edit data in a form. On a form, you have many more formatting options. The suggestion I made in my first reply in this thread was meant for a text box on a form.

  8. #8
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    Toronto, Ontario, Canada
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field Color (2002)

    I agree.
    I am assuming (since this request is not coming from me directly) that my friend wishes to format the table field color for developement purposes, and not for end users. I will recommend simply using a form to browse/edit the table and setting the text box field format property to the desired color.
    Thanks for the input,

  9. #9
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    Toronto, Ontario, Canada
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field Color (2002)

    I just spoke with my friend. The reason she wanted to have the table field color changed was because she wanted to export the table into Excel and keep the formatting. Unforetunetly, this does not work in a table, report or form. Any ideas as to how to export to Excel and keep the color format?
    (Sorry, I really should have found that out in the first place and avoided all previous discussion)
    Thanks,

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Field Color (2002)

    I don't think that there is a standard way to export data from Access to Excel complete with color formatting.

    The formatting must be applied in Excel itself. It would be possible to write VBA code to do this from Access using Automation, but frankly, I don't think that would be worth the time spent on it.

  11. #11
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Field Color (2002)

    It's kind of crude, but you can use the simple OutputTo command to export an Access object such as a table, query, form, or report to Excel and preserve some of the formatting. Note that when you view a table in datasheet view, you cannot format a single field - any backgound color, font color, etc is applied to the entire datasheet. I'd recommend create simple continuous-forms type form based on table (using Form Wizard), and apply desired formatting to the field or fields in question. The data in table (as represented by form) can then be exported to Excel with a one-line command like this example:

    Sub OutputToExcel()

    ' Note: will export to Excel 5.0/95 format:
    DoCmd.OutputTo acOutputForm, "Employees_frm", acFormatXLS, "C:AccessTestOutputForm.xls", True

    End Sub

    As noted, the Excel file created by this command will be in Excel 5.0/95 format. In above example, created simple form based on Northwind "Employees" table, and set backcolor for LastName and FirstName to yellow. The attached screen shot shows the Excel file created by OutputTo command, as is, without any modifications. Note that the font (Arial 10) and yellow backcolor used in form are reflected in the resulting spreadsheet.

    For more fine-tuned control over final output in Excel, you'd have to use Automation. For a simple export, the OutputTo command may suffice.

    HTH
    Attached Images Attached Images

Posting Permissions

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