Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

how do I limit the length of the memo field

Discussion in 'Information Technology' started by Harold Good, Jul 28, 2006.

  1. Harold Good

    Harold Good
    Expand Collapse
    Guest

    Hi,

    Is there an easy way to limit the size of the memo field?

    I'd like to limit it to about 100 words or about 500 characters so that
    people can't enter too much data.

    Thanks,
    Harold
     
  2. Loading...

    Similar Threads Forum Date
    Opinion The Limitations of Being ‘Spiritual but Not Religious’ Breaking News Mar 23, 2013
    What actually are the 3 worlds? And is Maya limited only to the physical plane? Questions and Answers Nov 30, 2012
    Legal Cash Limit Breaking News Apr 4, 2012
    India Govt Mulls Proposal to Limit Number of Guests at Weddings Breaking News Feb 22, 2011
    The Limits of Free Will Interfaith Dialogues Feb 7, 2011

  3. Graham Mandeno

    Graham Mandeno
    Expand Collapse
    Guest

    Hi Harold

    You could use the Change event of your textbox to monitor the length of the
    text and give a message when a limit has been reached. For example:

    Private Sub MyMemoField_Change()
    With MyMemoField
    If Len(.Text) > 500 Then
    .Text = Left( .Text, 500 )
    MsgBox "Please try to be a little less verbose"
    End If
    End With
    End Sub

    You could even have a "length countdown display" like a cell phone when you
    send a text message:

    txtCharsLeft = 500 - Len(MyMemoField.Text)

    --
    Good Luck!

    Graham Mandeno [Access MVP]
    Auckland, New Zealand

    "Harold Good" <hcgood@hotmail.com> wrote in message
    news:e43lAvyjGHA.4264@TK2MSFTNGP02.phx.gbl...
    > Hi,
    >
    > Is there an easy way to limit the size of the memo field?
    >
    > I'd like to limit it to about 100 words or about 500 characters so that
    > people can't enter too much data.
    >
    > Thanks,
    > Harold
    >
     
  4. Jamie Collins

    Jamie Collins
    Expand Collapse
    Guest

    Harold Good wrote:
    > I'd like to limit it to about 100 words or about 500 characters so that
    > people can't enter too much data.


    Create Validation Rules (or CHECK constraints) in your database.

    Suggestions (untested)

    max 500 characters:
    LEN(memo_col) <= 500

    max 100 space-separated words
    LEN(memo_col) - REPLACE$(memo_col, ' ', '') < 100

    I'd also suggest you prevent 'double' spaces:
    memo_col NOT LIKE '% %'
    AND memo_col NOT LIKE '* *'

    Jamie.

    --
     
  5. Harold Good

    Harold Good
    Expand Collapse
    Guest

    Hi, I have done this below and it works well. But with the
    txtCharsLeft = 500 - Len(MyMemoField.Text)
    I wasn't sure where to put it, so I put it in the ControlSource.

    But is there any way to get it to countdown live, as the letters are being
    typed?
    As it is now, it doesn't update until I click out of the memo section.

    Thanks,
    Harold

    ===============
    "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    news:%23IuBU2yjGHA.4776@TK2MSFTNGP05.phx.gbl...
    > Hi Harold
    >
    > You could use the Change event of your textbox to monitor the length of
    > the text and give a message when a limit has been reached. For example:
    >
    > Private Sub MyMemoField_Change()
    > With MyMemoField
    > If Len(.Text) > 500 Then
    > .Text = Left( .Text, 500 )
    > MsgBox "Please try to be a little less verbose"
    > End If
    > End With
    > End Sub
    >
    > You could even have a "length countdown display" like a cell phone when
    > you send a text message:
    >
    > txtCharsLeft = 500 - Len(MyMemoField.Text)
    >
    > --
    > Good Luck!
    >
    > Graham Mandeno [Access MVP]
    > Auckland, New Zealand
    >
    > "Harold Good" <hcgood@hotmail.com> wrote in message
    > news:e43lAvyjGHA.4264@TK2MSFTNGP02.phx.gbl...
    >> Hi,
    >>
    >> Is there an easy way to limit the size of the memo field?
    >>
    >> I'd like to limit it to about 100 words or about 500 characters so that
    >> people can't enter too much data.
    >>
    >> Thanks,
    >> Harold
    >>

    >
    >
     
  6. Ron2006

    Ron2006
    Expand Collapse
    Guest

    OnChange event
     
  7. Ron2006

    Ron2006
    Expand Collapse
    Guest

    OnChange event of the memo field itself.
     
  8. Graham Mandeno

    Graham Mandeno
    Expand Collapse
    Guest

    Hi Harold

    Sorry if that wasn't clear. You should add it as another line in the Change
    event procedure for the memo textbox.

    Add a textbox named txtCharsLeft and make it disabled and locked. Then add
    this line just before the "End With":

    txtCharsLeft = 500 - Len(.Text)

    --
    Good Luck!

    Graham Mandeno [Access MVP]
    Auckland, New Zealand

    "Harold Good" <hcgood@hotmail.com> wrote in message
    news:OzAf7LLkGHA.896@TK2MSFTNGP04.phx.gbl...
    > Hi, I have done this below and it works well. But with the
    > txtCharsLeft = 500 - Len(MyMemoField.Text)
    > I wasn't sure where to put it, so I put it in the ControlSource.
    >
    > But is there any way to get it to countdown live, as the letters are being
    > typed?
    > As it is now, it doesn't update until I click out of the memo section.
    >
    > Thanks,
    > Harold
    >
    > ===============
    > "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    > news:%23IuBU2yjGHA.4776@TK2MSFTNGP05.phx.gbl...
    >> Hi Harold
    >>
    >> You could use the Change event of your textbox to monitor the length of
    >> the text and give a message when a limit has been reached. For example:
    >>
    >> Private Sub MyMemoField_Change()
    >> With MyMemoField
    >> If Len(.Text) > 500 Then
    >> .Text = Left( .Text, 500 )
    >> MsgBox "Please try to be a little less verbose"
    >> End If
    >> End With
    >> End Sub
    >>
    >> You could even have a "length countdown display" like a cell phone when
    >> you send a text message:
    >>
    >> txtCharsLeft = 500 - Len(MyMemoField.Text)
    >>
    >> --
    >> Good Luck!
    >>
    >> Graham Mandeno [Access MVP]
    >> Auckland, New Zealand
    >>
    >> "Harold Good" <hcgood@hotmail.com> wrote in message
    >> news:e43lAvyjGHA.4264@TK2MSFTNGP02.phx.gbl...
    >>> Hi,
    >>>
    >>> Is there an easy way to limit the size of the memo field?
    >>>
    >>> I'd like to limit it to about 100 words or about 500 characters so that
    >>> people can't enter too much data.
    >>>
    >>> Thanks,
    >>> Harold
    >>>

    >>
    >>

    >
    >
     
  9. Harold Good

    Harold Good
    Expand Collapse
    Guest

    This is great, counting now keeps up with letters being entered!

    Thanks much for your help,
    Harold
    ==================
    "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    news:%23fu2QCOkGHA.4444@TK2MSFTNGP02.phx.gbl...
    > Hi Harold
    >
    > Sorry if that wasn't clear. You should add it as another line in the
    > Change event procedure for the memo textbox.
    >
    > Add a textbox named txtCharsLeft and make it disabled and locked. Then
    > add this line just before the "End With":
    >
    > txtCharsLeft = 500 - Len(.Text)
    >
    > --
    > Good Luck!
    >
    > Graham Mandeno [Access MVP]
    > Auckland, New Zealand
    >
    > "Harold Good" <hcgood@hotmail.com> wrote in message
    > news:OzAf7LLkGHA.896@TK2MSFTNGP04.phx.gbl...
    >> Hi, I have done this below and it works well. But with the
    >> txtCharsLeft = 500 - Len(MyMemoField.Text)
    >> I wasn't sure where to put it, so I put it in the ControlSource.
    >>
    >> But is there any way to get it to countdown live, as the letters are
    >> being typed?
    >> As it is now, it doesn't update until I click out of the memo section.
    >>
    >> Thanks,
    >> Harold
    >>
    >> ===============
    >> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >> news:%23IuBU2yjGHA.4776@TK2MSFTNGP05.phx.gbl...
    >>> Hi Harold
    >>>
    >>> You could use the Change event of your textbox to monitor the length of
    >>> the text and give a message when a limit has been reached. For example:
    >>>
    >>> Private Sub MyMemoField_Change()
    >>> With MyMemoField
    >>> If Len(.Text) > 500 Then
    >>> .Text = Left( .Text, 500 )
    >>> MsgBox "Please try to be a little less verbose"
    >>> End If
    >>> End With
    >>> End Sub
    >>>
    >>> You could even have a "length countdown display" like a cell phone when
    >>> you send a text message:
    >>>
    >>> txtCharsLeft = 500 - Len(MyMemoField.Text)
    >>>
    >>> --
    >>> Good Luck!
    >>>
    >>> Graham Mandeno [Access MVP]
    >>> Auckland, New Zealand
    >>>
    >>> "Harold Good" <hcgood@hotmail.com> wrote in message
    >>> news:e43lAvyjGHA.4264@TK2MSFTNGP02.phx.gbl...
    >>>> Hi,
    >>>>
    >>>> Is there an easy way to limit the size of the memo field?
    >>>>
    >>>> I'd like to limit it to about 100 words or about 500 characters so that
    >>>> people can't enter too much data.
    >>>>
    >>>> Thanks,
    >>>> Harold
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     

Share This Page