Hello,
Have attached an HSQLDB sample to demo this.
This can be done with a macro :
Option Explicit
Sub CharLeftCount()
Dim oForm As Object
Dim sText As String
Dim nDisplaySize As Integer
Dim nEnteredSize As Integer
Dim nRemaining As Integer
Rem Get internal form
oForm = ThisComponent.Drawpage.Forms.getbyname( "MainForm" )
Rem Get table field size
nDisplaySize = oForm.getColumns().getByName("NOTE").DisplaySize
Rem Get text box string
sText = oForm.getByName("txtNOTE").Text
Rem Get length of current text
nEnteredSize = Len(sText)
Rem Calculate remaining characters available
nRemaining = nDisplaySize - nEnteredSize
Rem Display in Label control
oForm.getByName("LabelCharCount").Label = "Characters Remaining = " & nRemaining
End Sub
Table field name, internal form name and field name apply to sample only. Modify as needed for your use. You also need to set Max. text length
in the text box properties (General tab) to match the field length set in the table.
This sub is attached to the Key released
event of the text box AND the After record change
event of the form.
Sample ----- CharRemaining.odb