Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Aug 2003
    Location
    Green Bay, Wisconsin, USA
    Posts
    396
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Conditional formatting (2000/XP)

    I'm looking for some help or documentation on Conditional formatting in Access. In Access 97 we used some VBA to change the color of a field on a report if the value of field "Spent" was greater than the value of field "AuthorizedValue" or within 90% of the value of "AuthorizedValue." But now they want that changed to compare "Spent" to the field "PO Value." The VBA code has issues with the field name because of the space in the name. I just don't know enough about VBA to know how to change the code.

    I thought maybe I could use conditional formatting since the VBA code is just changing the color of the background. I seem to have the same issue with the field name. I was trying to use "Between "PO Value" and 0.9*"PO Value"

    Does anyone have a reference for Conditional formatting? or How do I change the VBA or conditional formatting to use a field with a space in the name?

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

    Re: Conditional formatting (2000/XP)

    Names of fields, tables, queries etc. with spaces or unusual characters must be enclosed in square brackets [ ], not in quotes. for example:<pre>Between [PO Value] And 0.9*[PO Value]</pre>

    This holds for VBA, and also in expressions in a query and on a form, and when specifying conditional formatting.

  3. #3
    3 Star Lounger
    Join Date
    Aug 2003
    Location
    Green Bay, Wisconsin, USA
    Posts
    396
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Conditional formatting (2000/XP)

    Thanks, Hans.

    I have seen that Access puts square brackets around fields, but it never dawned on me to use them in VBA. I'm just not up to speed in VBA.

Posting Permissions

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