Heenan, Lambert
Lambert.Heenan at AIG.com
Mon Aug 25 13:13:41 CDT 2003
A simple event handler for the Change event should do it.
Private Sub combo1_Change()
If Len(combo1.Text) > 100 Then
MsgBox "Too long"
combo1 = Left(combo1.Text, 100)
End If
End Sub
Lambert
> -----Original Message-----
> From: Kath Pelletti [SMTP:sdssoftware at optusnet.com.au]
> Sent: Friday, August 22, 2003 1:24 AM
> To: AccessD at databaseadvisors.com
> Subject: [AccessD] Form error - problem with length of column 1
>
> Hi everyone - hoping for some help with a strange error that I have never
> run into before..
>
> Users are entering data into a combo box bound to a field called CostID.
> The Combo has 3 columns - CostID, CostDescription and DefaultCost.
>
> As usual, the width of the first column is set to 0 and it is the bound
> column, so that the users only see the description column, and when they
> make a selection I store the id.
>
> The problem is that the description field is a text field with a 100 char
> limit. But as the users type into the combo control to enter a new cost,
> the field isn't limiting them to the 100 chars. It is as if the combo
> ignores the real length of the 2nd column of its row source.
>
> The second part of the problem is that when they are entering a new cost,
> I have 'notinlist' code in place which opens a new form so that staff can
> add more details for new records. But when the form attempts to load the
> openargs property from the first form, it throws an error 'attempted to
> paste too much data..." etc.
>
> I know I can use code to truncate the field after it has been entered, but
> what I want to is to limit them users back in the first place to only be
> able to enter 100 chars. I have played around with input masks,
> eg'CCCCCCCCCCCCCCC' etc for 100 chars but they look awful when displayed.
> The row source of the combo is as below:
>
> The CostID field gas 3 columns and has a row source of
> "SELECT TBLLUCostTypes.CostType, TBLLUCostTypes.CostDescription,
> TBLLUCostTypes.DefaultCost FROM TBLLUCostTypes ORDER BY
> TBLLUCostTypes.CostDescription;"
>
> Any tips?
>
>
> Kath Pelletti
> Software Design & Solutions Pty Ltd.
> Ph: 9505-6714
> Fax: 9505-6430
> sdssoftware at optusnet.com.au <mailto:sdssoftware at optusnet.com.au> << File:
> ATT3804527.txt >>