+ Reply to Thread
Results 1 to 4 of 4

how to ignore HTLM tags when getting a length of a memo field

  1. #1
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    how to ignore HTLM tags when getting a length of a memo field

    Hello,

    After searching through the archives and not finding something resembling my problem, I'm hoping someone can help me. Excel is my world, but Access, not so much...

    I have memo field in a form that we are now limiting the number of characters to 350.

    I found this code somewhere that works brilliantly.

    Please Login or Register  to view this content.
    CharCountMemo1 is a lable and Memo1 is my memo field.

    Like I said, it works great, however, because it's a memo field (and I would like to keep it as is), when computing the Len of Memo1, it's also including the HTLM tags (<ul>, <li>, etc.) to the length.

    Is there a way to "ignore" these tags to get the actual character count which I want to limit to 350 only?

    Hope this is clear enough.

    Thank you,
    Dennis

    PS I haven't tried yet, but is there also a way to incorporate a "condition formatting" feature that fills the memo field RED if it is currently over 350 characters. You see, the character limit is a new feature that we are trying to put in an existing working database. I want the obnoxious RED to show the user that they have something to fix.
    Last edited by djapigo; 01-03-2013 at 06:43 PM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: how to ignore HTLM tags when getting a length of a memo field

    I would have suggested using the Replace() function with a wildcard, but apparently you can't use a wildcard with the replace function. This function will strip out all the html tags from a string. Put it inside your LEN() functions in lines two and three (or assign a variable for efficiency).

    Please Login or Register  to view this content.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: how to ignore HTLM tags when getting a length of a memo field

    Hi davegugg,

    The code seems to be working great! I just have to tweak it a little bit to include if strInput is "blank".

    I'll let you know if I find other problems with it.

    In the meantime, thank you so much for guiding me to the right direction!

    Dennis

  4. #4
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: how to ignore HTLM tags when getting a length of a memo field

    Hi davegugg,

    Here is what I added to meet my conditions... blank entry, carriage return and blank spaces

    Please Login or Register  to view this content.
    Thank you so much for your code... it set me up perfectly... project complete!

    Dennis

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1