Tony Septav
iggy at nanaimo.ark.com
Mon Nov 14 13:11:49 CST 2005
Hey All
Thanks again. But I could not trap (and I don't think you can, using the
form control events) for the Paste from clipboard error " "The text is
too long to be edited". So I trap for it on the on keydown event for
the text box.
ClipBoard_GetData() = Is a function (not mine) that will allow you to
get the text currently stored in the clipboard.
Hope this may be of use to others.
Dim msg As String
If Shift = 2 Then
If KeyCode = 86 Then 'or vbKeyP
If Len(ClipBoard_GetData()) + (Len(Me!DName.Text) -
Len(Me!DName.SelText)) > 125 Then
DoCmd.Beep
msg = "The text you are trying to paste creates an entry
that is too long " & Chr(13) & Chr(13)
msg = msg & "Non - selected text - " & (Len(Me!DName.Text) -
Len(Me!DName.SelText)) & Chr(13)
msg = msg & "Plus Text to Paste - " &
Len(ClipBoard_GetData()) & Chr(13)
msg = msg & "Equals - " & Len(ClipBoard_GetData()) +
(Len(Me!DName.Text) - Len(Me!DName.SelText)) & " characters..." &
Chr(13) & Chr(13)
MsgBox msg & "The maximum number of characters for this
entry is 125.", 48, "MyChecker"
Shift = 0
KeyCode = 0
End If
End If
End If
If Shift = 1 Then
If KeyCode = vbKeyInsert Then
If Len(ClipBoard_GetData()) + (Len(Me!DName.Text) -
Len(Me!DName.SelText)) > 125 Then
DoCmd.Beep
msg = "The text you are trying to paste creates an entry
that is too long " & Chr(13) & Chr(13)
msg = msg & "Non - selected text - " & (Len(Me!DName.Text) -
Len(Me!DName.SelText)) & Chr(13)
msg = msg & "Plus Text to Paste - " &
Len(ClipBoard_GetData()) & Chr(13)
msg = msg & "Equals - " & Len(ClipBoard_GetData()) +
(Len(Me!DName.Text) - Len(Me!DName.SelText)) & " characters..." &
Chr(13) & Chr(13)
MsgBox msg & "The maximum number of characters for this
entry is 125.", 48, "MyChecker"
Shift = 0
KeyCode = 0
End If
End If
End