By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,795 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,795 IT Pros & Developers. It's quick & easy.

Limit Characters allowed in a Memo Field

P: 2
Hi there,

I really hope someone can help as I have been trying for two days now and to no avail.

I am trying to add a validation rule to a memo type field in MS Access 2007. I need to limit the amount of text that can be entered into this field to about 1000 characters. I have tried using the following validation command but it is not working! Any ideas would be very greatfully recieved! :)

Validation Rule =Len("Specification")<1000

where "Specification" is the name of the memo field I need to limit.

PLEASE HELP ME!!

Thanks, TechyGal
Aug 30 '07 #1
Share this Question
Share on Google+
5 Replies


missinglinq
Expert 2.5K+
P: 3,532
And what do you want to do when the limit is reached? Simply use the first 1000 characters, throw up a message telling the user the data is being truncated to 1000 characters, something else?

This will do both:
Expand|Select|Wrap|Line Numbers
  1. Private Sub MyMemoField_Change()
  2. Dim CharCount As Integer
  3.  
  4. If Not IsNull(Len(MyMemoField)) Then
  5.  CharCount = Len(MyMemoField.Text)
  6.   If CharCount > 1000 Then
  7.    MsgBox "You've reached the limit"
  8.    Me.MyMemoField = Left(Me.MyMemoField.Text, 1000)
  9.   End If
  10. End If
  11. End Sub
  12.  
Welcome to TheScripts!

Linq ;0)>
Aug 30 '07 #2

MGrowneyARSI
P: 90
Take a look at this site some in the past was trying to do the same thing and said this put him in the right direction looks a bit more complex then you wouild think http://www.allenbrowne.com/ser-34.html hope that helps
Aug 30 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
MGrowneyARSI, just FYI, when posting links you need to use the URL tags, such as here:

[ URL ]http://www.allenbrowne.com/ser-34.html[ /URL ]

but eliminating the spaces inside of the square brackets.

Linq ;0)>
Aug 30 '07 #4

MGrowneyARSI
P: 90
Sure thing will do next time
Aug 30 '07 #5

FishVal
Expert 2.5K+
P: 2,653
Hi, TechyGal

Len("Specification") always returns 13, the length of word "Specification". ;)
Use square brackets to enclose field name. Len([Specification])<1000

Good luck.
Aug 30 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.