Results 1 to 4 of 4
  1. #1
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211

    Apply Format to TextBox on 1 Record Only (without conditional formatting)

    Hi,

    I have a continuous form which is tied to a particular table. Is there any way to apply a particular format to a TextBox, but only for a particular record (based on a data field in the record).

    I can't use conditional formatting, because I'm trying to apply a text format rather than the type of formatting available in conditional formatting.

    For example, one field in the table is for a phone number. That is the field that is bound to the particular TextBox.
    But another field in the table (not a field that is displayed on my continuous form) contains a format string, such as "(@@@) @@@-@@@@".


    What I want to do is format the TextBox so the phone number shows up with this format.

    Currently, it is "all or nothing" unless you use conditional formatting, but conditional formatting does not allow for numeric formats.
    If I try to apply a numeric format, then all records in the table/form show up with that numeric format, even if not applicable to that particular record.

    I've described this as simply as I can, but if anyone is confused or needs more information about my issue, please reply and I will add a full description of why the same field in a different record may or may not want to be formatted.

    Any way around this problem? Thanks...

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    the answer is no it can’t be done. What can be done is store the value in the required format in the first place

    if you need more help provide examples, not descriptions

  3. #3
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    You could possibly apply the format in an underlying query using a calculation, maybe an IIf() would do it?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    Thanks for the replies. Using your comments, I decided to format the data prior to displaying. Which means that if I click in a textbox to edit that data, I need to remove the formatting first (in the Enter event), then reformat it in the Exit or After_Update events. In my case, the easiest way was to have the underlying table have 2 different fields for the value: RawValue and FormattedValue, this one being the field bound to that textbox. On_Enter event replaces the formatted value with the raw value, and On_Exit or After_Update events re-formatting the raw value (which I may or may not have edited).

    Thanks again...

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

Similar Threads

  1. Replies: 11
    Last Post: 12-08-2015, 11:47 AM
  2. Export query to Excel and apply conditional formatting
    By mcpearce in forum Import/Export Data
    Replies: 4
    Last Post: 04-27-2014, 05:26 PM
  3. Replies: 7
    Last Post: 03-03-2014, 01:36 PM
  4. Replies: 3
    Last Post: 08-02-2013, 12:18 PM
  5. how to apply Conditional Formatting in run time
    By selvakumar.arc in forum Forms
    Replies: 7
    Last Post: 07-03-2013, 12:41 PM

Tags for this Thread

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