Results 1 to 4 of 4

Thread: Vba

  1. #1
    Join Date
    Nov 2009
    Posts
    29

    Unanswered: Vba

    I need help on how to create a procedure on a form like:

    display the Price field value in red when the value is greater than $1000 and in black for other values; and

    and how to convert CompanyName field values to proper case--capitalize the first letter of each word, and convert all other letters to lowercase.

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    In Form Design View, select the Price textbox

    Goto Format - Conditional Formatting

    Then Select:

    Field Value Is

    Greater Than

    Then Type in 1000

    For the second question, In the CompanyName AfterUpdate event place this code:

    StrConv(CompanyName, vbProperCase)
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    For the conditional formatting, if Missinglinq's suggestion doesn't work, you can also change the condition to an expression and then enter something like [MyFieldName]>1000. But try Missinglinq's suggestion first.

    Regarding Missinglinq's 2nd suggestion, I'm not sure if vbProperCase needs the Excel Reference or not. I can't recall if this is a function built into the references MSAccess typically defaults to. But again, give Missinglinq's suggestion a try first. I just tested it and I'm wrong. It is built-in. Thanks Missinglinq - I was actually going to need this in the future as well.
    Last edited by pkstormy; 11-21-09 at 22:56.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad to help!
    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
  •