B
Bob Vance
Can you restrict a text box to only one line, my text box only shows one
line!
line!
Gina Whipp said:Bob,
Then what you would want is characters... You could put something like
this
in the On_Exit of the field...
'Watch out for word wrap
Private Sub txtYourTextBox_Exit(Cancel As Integer)
If Len([txtText]) > ??? Then
MsgBox "You have exceeded the ??? character limit by " &
Len([txtText]) - ??? & " characters. It will not be seen in its
entirety",
vbCritical, "Too Many Characters"
DoCmd.CancelEvent
End If
End Sub
OR
'------ start of example code ------
Private Sub Text0_KeyPress(KeyAscii As Integer)
'Posted by Dirk Goldgar, MS Access MVP
Const conMaxChars = 10
Select Case KeyAscii
Case vbKeyReturn, vbKeyTab, vbKeyDelete, vbKeyBack
Case Else
With Me.Text0
If Len(.Text) >= conMaxChars Then
If .SelLength = 0 Then
MsgBox "Sorry, no more than " & conMaxChars & "
characters will fit!"
KeyAscii = 0
End If
End If
End With
End Select
End Sub
'------ end of example code ------
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" - Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Thanks Gina, Actually in size because someone could enter some data on the
next line and it wont be seen
Regards Bob
Gina Whipp said:Bob,
In size or in characters? Not sure I understand...
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Can you restrict a text box to only one line, my text box only shows one
line!
Gina Whipp said:Bob,
Then what you would want is characters... You could put something like
this
in the On_Exit of the field...
'Watch out for word wrap
Private Sub txtYourTextBox_Exit(Cancel As Integer)
If Len([txtText]) > ??? Then
MsgBox "You have exceeded the ??? character limit by " &
Len([txtText]) - ??? & " characters. It will not be seen in its
entirety",
vbCritical, "Too Many Characters"
DoCmd.CancelEvent
End If
End Sub
OR
'------ start of example code ------
Private Sub Text0_KeyPress(KeyAscii As Integer)
'Posted by Dirk Goldgar, MS Access MVP
Const conMaxChars = 10
Select Case KeyAscii
Case vbKeyReturn, vbKeyTab, vbKeyDelete, vbKeyBack
Case Else
With Me.Text0
If Len(.Text) >= conMaxChars Then
If .SelLength = 0 Then
MsgBox "Sorry, no more than " & conMaxChars & "
characters will fit!"
KeyAscii = 0
End If
End If
End With
End Select
End Sub
'------ end of example code ------
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" - Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Thanks Gina, Actually in size because someone could enter some data on the
next line and it wont be seen
Regards Bob
Gina Whipp said:Bob,
In size or in characters? Not sure I understand...
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Can you restrict a text box to only one line, my text box only shows one
line!
Bob Vance said:Thanks Gina, Just having trouble with the msgbox!
Regards Bob
Private Sub tbName_Exit(Cancel As Integer)
If Len([tbName]) > 80 Then
MsgBox "You have exceeded the 80 characters limit by "
&Len([tbName]) & " characters. It will not be seen in its entirety",
vbCritical , "Too Many Characters"
DoCmd.CancelEvent
End If
End Sub
Gina Whipp said:Bob,
Then what you would want is characters... You could put something like
this
in the On_Exit of the field...
'Watch out for word wrap
Private Sub txtYourTextBox_Exit(Cancel As Integer)
If Len([txtText]) > ??? Then
MsgBox "You have exceeded the ??? character limit by " &
Len([txtText]) - ??? & " characters. It will not be seen in its
entirety",
vbCritical, "Too Many Characters"
DoCmd.CancelEvent
End If
End Sub
OR
'------ start of example code ------
Private Sub Text0_KeyPress(KeyAscii As Integer)
'Posted by Dirk Goldgar, MS Access MVP
Const conMaxChars = 10
Select Case KeyAscii
Case vbKeyReturn, vbKeyTab, vbKeyDelete, vbKeyBack
Case Else
With Me.Text0
If Len(.Text) >= conMaxChars Then
If .SelLength = 0 Then
MsgBox "Sorry, no more than " & conMaxChars & "
characters will fit!"
KeyAscii = 0
End If
End If
End With
End Select
End Sub
'------ end of example code ------
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Thanks Gina, Actually in size because someone could enter some data on
the
next line and it wont be seen
Regards Bob
Gina Whipp said:Bob,
In size or in characters? Not sure I understand...
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Can you restrict a text box to only one line, my text box only shows one
line!
Bob Vance said:Thanks Gina, Just having trouble with the msgbox!
Regards Bob
Private Sub tbName_Exit(Cancel As Integer)
If Len([tbName]) > 80 Then
MsgBox "You have exceeded the 80 characters limit by "
&Len([tbName]) & " characters. It will not be seen in its entirety",
vbCritical , "Too Many Characters"
DoCmd.CancelEvent
End If
End Sub
Gina Whipp said:Bob,
Then what you would want is characters... You could put something like
this
in the On_Exit of the field...
'Watch out for word wrap
Private Sub txtYourTextBox_Exit(Cancel As Integer)
If Len([txtText]) > ??? Then
MsgBox "You have exceeded the ??? character limit by " &
Len([txtText]) - ??? & " characters. It will not be seen in its
entirety",
vbCritical, "Too Many Characters"
DoCmd.CancelEvent
End If
End Sub
OR
'------ start of example code ------
Private Sub Text0_KeyPress(KeyAscii As Integer)
'Posted by Dirk Goldgar, MS Access MVP
Const conMaxChars = 10
Select Case KeyAscii
Case vbKeyReturn, vbKeyTab, vbKeyDelete, vbKeyBack
Case Else
With Me.Text0
If Len(.Text) >= conMaxChars Then
If .SelLength = 0 Then
MsgBox "Sorry, no more than " & conMaxChars & "
characters will fit!"
KeyAscii = 0
End If
End If
End With
End Select
End Sub
'------ end of example code ------
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Thanks Gina, Actually in size because someone could enter some data on
the
next line and it wont be seen
Regards Bob
Gina Whipp said:Bob,
In size or in characters? Not sure I understand...
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Can you restrict a text box to only one line, my text box only shows one
line!
Gina Whipp said:Bob,
Then what you would want is characters... You could put something like
this
in the On_Exit of the field...
'Watch out for word wrap
Private Sub txtYourTextBox_Exit(Cancel As Integer)
If Len([txtText]) > ??? Then
MsgBox "You have exceeded the ??? character limit by " &
Len([txtText]) - ??? & " characters. It will not be seen in its
entirety",
vbCritical, "Too Many Characters"
DoCmd.CancelEvent
End If
End Sub
OR
'------ start of example code ------
Private Sub Text0_KeyPress(KeyAscii As Integer)
'Posted by Dirk Goldgar, MS Access MVP
Const conMaxChars = 10
Select Case KeyAscii
Case vbKeyReturn, vbKeyTab, vbKeyDelete, vbKeyBack
Case Else
With Me.Text0
If Len(.Text) >= conMaxChars Then
If .SelLength = 0 Then
MsgBox "Sorry, no more than " & conMaxChars & "
characters will fit!"
KeyAscii = 0
End If
End If
End With
End Select
End Sub
'------ end of example code ------
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" - Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Thanks Gina, Actually in size because someone could enter some data on the
next line and it wont be seen
Regards Bob
Gina Whipp said:Bob,
In size or in characters? Not sure I understand...
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Can you restrict a text box to only one line, my text box only shows one
line!
James Hall said:(e-mail address removed)
Gina Whipp said:Bob,
Then what you would want is characters... You could put something like
this
in the On_Exit of the field...
'Watch out for word wrap
Private Sub txtYourTextBox_Exit(Cancel As Integer)
If Len([txtText]) > ??? Then
MsgBox "You have exceeded the ??? character limit by " &
Len([txtText]) - ??? & " characters. It will not be seen in its
entirety",
vbCritical, "Too Many Characters"
DoCmd.CancelEvent
End If
End Sub
OR
'------ start of example code ------
Private Sub Text0_KeyPress(KeyAscii As Integer)
'Posted by Dirk Goldgar, MS Access MVP
Const conMaxChars = 10
Select Case KeyAscii
Case vbKeyReturn, vbKeyTab, vbKeyDelete, vbKeyBack
Case Else
With Me.Text0
If Len(.Text) >= conMaxChars Then
If .SelLength = 0 Then
MsgBox "Sorry, no more than " & conMaxChars & "
characters will fit!"
KeyAscii = 0
End If
End If
End With
End Select
End Sub
'------ end of example code ------
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Thanks Gina, Actually in size because someone could enter some data on
the
next line and it wont be seen
Regards Bob
Gina Whipp said:Bob,
In size or in characters? Not sure I understand...
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Can you restrict a text box to only one line, my text box only shows one
line!
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.