Results 1 to 4 of 4
  1. #1
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165

    Conditionally Format Text Box's Format Property

    Post title is a mouth full, sorry about that.



    Is it possible to conditionally format a textbox's Format property in a continuous form?

    For example using the table below, I'd like the Qty field in rows with 'FEET' units to be formatted as Standard w/ out decimals.
    With 'PERCENT' to be formatted as a percentage.

    Code:
    Qty  | Unit
    -----+--------
    1.10 | FEET
    0.10 | PERCENT
    
    BECOMES
    
    Qty  | Unit
    -----+--------
    1    | FEET
    10%  | PERCENT
    Ideas?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Is Qty a number data type? If so, you could try Int(Qty)

    For Percent 100*Int(Qty))

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Replace the control property with a calculated expressions that uses the Format() function to format the QTY based on your needs:

    FORMATED_QTY: IIf([UNIT]="PERCENT",Format([QTY],"Percent"),Format([QTY],"Standard"))

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #4
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    I should add that the control should remain editable.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 12-30-2016, 10:27 AM
  2. VBA to conditionally format subform
    By Scottish_Anatomist in forum Programming
    Replies: 5
    Last Post: 03-12-2016, 05:26 AM
  3. Replies: 5
    Last Post: 07-18-2013, 01:43 PM
  4. Replies: 5
    Last Post: 06-23-2012, 04:30 PM
  5. Replies: 3
    Last Post: 03-12-2012, 01:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums