From: User via AccessMonster.com on
I'm trying to display the character count of a textbox in a label.

The format I'm trying to achieve is something like: "1/60 Characters"

60 being the feild size I set for that textbox.

Any help would be great.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201001/1

From: fredg on
On Wed, 20 Jan 2010 00:03:04 GMT, User via AccessMonster.com wrote:

> I'm trying to display the character count of a textbox in a label.
>
> The format I'm trying to achieve is something like: "1/60 Characters"
>
> 60 being the feild size I set for that textbox.
>
> Any help would be great.

Using an unbound control:
=Len([ControlName]) & "/60"
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
From: John W. Vinson on
On Wed, 20 Jan 2010 00:03:04 GMT, "User via AccessMonster.com" <u36225(a)uwe>
wrote:

>I'm trying to display the character count of a textbox in a label.
>
>The format I'm trying to achieve is something like: "1/60 Characters"
>
>60 being the feild size I set for that textbox.
>
>Any help would be great.

Use the Change event of the textbox, which fires at every keystroke. For
example, put an unbound textbox txtChrs on the form, with a label containing
"/60 Characters" as its caption just to the right of the textbox. In the
Change event (and, if you want to see it for existing records, in the form's
Current event too) put

Private Sub yourtextbox_Change()
Me!txtChrs = Len(Me!yourtextbox)
End Sub

--

John W. Vinson [MVP]
From: User via AccessMonster.com on
Thank you everyone for your help.

I'm using the coding below to achieve the desired result.

------------------------------------------------------------------------------
----
Private Sub Form_Open(Cancel As Integer)
Me.txtChar = "0/60 Characters"
End Sub
------------------------------------------------------------------------------
---
Private Sub txtBoxA_Change()
Me.txtChar = Len(Nz(Me.txtBoxA.Text, "")) & "/60 Characters"
End Sub
------------------------------------------------------------------------------
---

Thanks again!!

--
Message posted via http://www.accessmonster.com