If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Form_Timer() does not work...
Hi,
I am trying to display the number of characters left in a text box since I want to limit the length of the string to 1000 characters. I thought that if I set the TimerInterval to 1000, and then the OnTimer event to check the lenght of the string in the text box, that I could display the remaining characters. The problem is that the OnTimer event only fires once, and then will not update again until I change records and then come back. Am I missing something basic here? Sub Form_Load() Me.TimerInterval = 1000 End Sub Sub Form_Timer() Dim iLeft As Integer If IsNull(Me.SampleText) Or Me.SampleText = "" Then iLeft = 1000 Else iLeft = 1000 - Len(Me.SampleText) End If Me.txtCount = "Characters Left: " & iLeft End Sub |
#2
|
|||
|
|||
Form_Timer() does not work...
Don't use the timer. Just use
=Len(Me.YourTextBoxName.Text) in the On Change event of the textbox -- Bob Larson Access MVP Access World Forums Administrator Utter Access VIP Free Access Resources at http://www.btabdevelopment.com "mikey014" wrote in message ... Hi, I am trying to display the number of characters left in a text box since I want to limit the length of the string to 1000 characters. I thought that if I set the TimerInterval to 1000, and then the OnTimer event to check the lenght of the string in the text box, that I could display the remaining characters. The problem is that the OnTimer event only fires once, and then will not update again until I change records and then come back. Am I missing something basic here? Sub Form_Load() Me.TimerInterval = 1000 End Sub Sub Form_Timer() Dim iLeft As Integer If IsNull(Me.SampleText) Or Me.SampleText = "" Then iLeft = 1000 Else iLeft = 1000 - Len(Me.SampleText) End If Me.txtCount = "Characters Left: " & iLeft End Sub |
#3
|
|||
|
|||
Form_Timer() does not work...
That worked perfectly! Here is the code as written:
Private Sub SampleText_Change() Dim iLeft As Integer iLeft = 1000 - Len(Me.SampleText.Text) Me.txtCount = "Characters left: " & iLeft End Sub "boblarson" wrote: Don't use the timer. Just use =Len(Me.YourTextBoxName.Text) in the On Change event of the textbox -- Bob Larson Access MVP Access World Forums Administrator Utter Access VIP Free Access Resources at http://www.btabdevelopment.com "mikey014" wrote in message ... Hi, I am trying to display the number of characters left in a text box since I want to limit the length of the string to 1000 characters. I thought that if I set the TimerInterval to 1000, and then the OnTimer event to check the lenght of the string in the text box, that I could display the remaining characters. The problem is that the OnTimer event only fires once, and then will not update again until I change records and then come back. Am I missing something basic here? Sub Form_Load() Me.TimerInterval = 1000 End Sub Sub Form_Timer() Dim iLeft As Integer If IsNull(Me.SampleText) Or Me.SampleText = "" Then iLeft = 1000 Else iLeft = 1000 - Len(Me.SampleText) End If Me.txtCount = "Characters Left: " & iLeft End Sub |
Thread Tools | |
Display Modes | |
|
|