This is an example of a form with 2 fields with a character count & cutoff:
To do this add these API declarations to a standard module (will need modifying if you have 64-bit Access)
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetFocus Lib "user32" () As Long 'used to find window handle
Then in your form, use code similar to this - I've removed error handling code to save space
Code:
Private Sub Report_Change()
SelText = SendMessage(hWnd, WM_COPY, 0, 0)
SetReportLength
End Sub
Private Sub SetReportLength()
'called by Change event for Report
Dim WindowHandle As Long
Dim MaxLength As Long
WindowHandle = GetFocus()
'Get the window handle for this window.
WindowHandle = GetFocus()
MaxLength = intReportLength 'this value is defined in a settings table or it can be hard coded
'Limit the number of characters in the Report text box.
SendMessage WindowHandle, ConstSetLimitText, MaxLength, 0
'get text length
Const WM_GETTEXTLENGTH = &HE
Me.txtCharCount = "( Characters remaining : " & MaxLength - SendMessage(WindowHandle, WM_GETTEXTLENGTH, 0, 0) & " )"
End Sub
You didn't answer my question about your frx file that I looked at for you