| Computers Forum Index » Computer - Databases - MS Access » Displaying the length of text in a textbox as it is... |
|
Page 1 of 1 |
|
| Author |
Message |
| John Paterson... |
Posted: Fri Oct 23, 2009 5:15 am |
|
|
|
Guest
|
Hi I am interfacing an Access database to an SMS gateway and wanted to
display the length of the SMS body as the user inputs it.
I have tried to use the Change Event on the unbound textbox being used to
input the SMS body and display the length in another unbount text box
however it appears that the length of the input textbox is not updated as
each key stroke is entered.
Private Sub SMSBody_Change()
MsgBox Str(Len(SMSBody))
CharCnt = Str(Len(SMSBody))
Does anyone know of a way around this?
John |
|
|
| Back to top |
|
|
|
| Lou O... |
Posted: Fri Oct 23, 2009 5:15 am |
|
|
|
Guest
|
On Oct 22, 9:16 pm, "John Paterson" <john.pater... at (no spam) kbc.org.au> wrote:
Quote: Hi I am interfacing an Access database to an SMS gateway and wanted to
display the length of the SMS body as the user inputs it.
I have tried to use the Change Event on the unbound textbox being used to
input the SMS body and display the length in another unbount text box
however it appears that the length of the input textbox is not updated as
each key stroke is entered.
Private Sub SMSBody_Change()
MsgBox Str(Len(SMSBody))
CharCnt = Str(Len(SMSBody))
Does anyone know of a way around this?
John
The KeyDown event of a textbox will give you the length of the input.
length = Len(Me.txtbox.Text)
To limit input to 10 characters add the following code in the KeyDown
event
If length > 10 then
KeyCode = 0
End If |
|
|
| Back to top |
|
|
|
|