how to limit the size of memo field

G

Guest

Hi, how can I limit the size of a memo field to about 100 words or 500
characters? I know how to do it for a text field, but for a memo field . . . ?

Any advice would be appreciated. I don't know how to use VBA, can it be done
without that?

Thanks,
H
 
G

Guest

I'm surprised but I think that I found an easy way to do this!

Open the table in design mode. Go to the memo field. In the Validation Rule
type something like:
Len([Name of memo field])<500

In the Validation Text type something like:
Must be less than 500 characters.

To make this take effect, you must not have any data now exceeding 500
characters. I suggest that you make a copy of the table, if not entire
database, before messing with it.
 
G

Guest

That's great, it does exactly what I wanted it to, thanks very much!
Harold

Jerry Whittle said:
I'm surprised but I think that I found an easy way to do this!

Open the table in design mode. Go to the memo field. In the Validation Rule
type something like:
Len([Name of memo field])<500

In the Validation Text type something like:
Must be less than 500 characters.

To make this take effect, you must not have any data now exceeding 500
characters. I suggest that you make a copy of the table, if not entire
database, before messing with it.
--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


HGood said:
Hi, how can I limit the size of a memo field to about 100 words or 500
characters? I know how to do it for a text field, but for a memo field . . . ?

Any advice would be appreciated. I don't know how to use VBA, can it be done
without that?

Thanks,
H
 
T

TC

Just be aware that this will still let the user enter 30,000 characters
(for example) - it will only object when he actually tries to leave
that field, or save the record. The risk is, the user will then say:
"Why the $%$##@! didn't you tell me this when I hit that limit 5
minutes' typing ago?"

So if that is likely to happen, it might be better for the user, if you
gave him a warning the moment he actually hits the limit.

This would do it, /roughly/ :

sub txtMemo_Change()
if len(me![txtMemo].text > 500 then
msgbox "Please limit your entry to 500 characters"
endif
end sub

where txtMemo is the name of the control on the form, not the field in
the table.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top