Is there any way I can count the charaters in a memo field including spaces.
I currently use the following procedure.
On Error GoTo Err_Form_BeforeUpdate
If Len(Me![Notes]) > 1560 Then
MsgBox "Your notes must be less than 1,560 characters.", vbInformation,
"Exceeded Field Limit"
Cancel = True
End If
Exit_Form_BeforeUpdate:
Exit Sub
Err_Form_BeforeUpdate:
MsgBox Err.Description
Resume Exit_Form_BeforeUpdate
I want the user to have the ability to check the count before trying to save
the record.
Just copy your existing If ... End If code (minus the 'Cancel = True' line)
to the Click event procedure of a command button.

Signature
Brendan Reynolds (MVP)
> Is there any way I can count the charaters in a memo field including
> spaces.
[quoted text clipped - 17 lines]
> save
> the record.
What you've done is OK, but I'd be inclined to use the Change() event, so
the users know exactly when they have exceeded the limit. After all, your
users are going to be real amused when you finally tell them that you're
going to discard the last 500 (excess) characters they've just entered.
Better to let them know early, in my opinion.
Private Sub Notes_Change()
If Len(Me.Notes.Text) > 1560 Then
DoCmd.Beep
'You can also put the MsgBox here if you must
Me.Notes.Text = Left(Me.Notes, 1560)
End If
End Sub
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
> Is there any way I can count the charaters in a memo field including
> spaces.
[quoted text clipped - 17 lines]
> save
> the record.
Tru - 15 Apr 2005 16:16 GMT
You know what your absolutely right it happened to me already Thanx fellows I
really apprecite the help.
> What you've done is OK, but I'd be inclined to use the Change() event, so
> the users know exactly when they have exceeded the limit. After all, your
[quoted text clipped - 37 lines]
> > save
> > the record.
Klatuu - 15 Apr 2005 16:17 GMT
Change Event????
The change event fires after every character is entered.
> What you've done is OK, but I'd be inclined to use the Change() event, so
> the users know exactly when they have exceeded the limit. After all, your
[quoted text clipped - 37 lines]
> > save
> > the record.
Graham R Seach - 15 Apr 2005 16:41 GMT
...barada nicto.
<<The change event fires after every character is entered>>
That's right!
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
> Change Event????
> The change event fires after every character is entered.
[quoted text clipped - 41 lines]
>> > save
>> > the record.