[AccessD] A2K: Number of characters typed into a field. (Solved)

Darren DICK d.dick at uws.edu.au
Tue Dec 2 22:08:14 CST 2003


Vlad
You da man!!!!!!!
Bob Thanks for the reply I went with Vlad's suggestion

Thanks guys

Darren

----- Original Message ----- 
From: "ACTEBS" <actebs at actebs.com.au>
To: "'Access Developers discussion and problem solving'" <accessd at databaseadvisors.com>
Sent: Wednesday, December 03, 2003 2:45 PM
Subject: RE: [AccessD] A2K: Number of characters typed into a field.


> Darren,
> 
> Try:
> 
> Len(Me.txtExplanation.Text)
> 
> HTH
> Vlad
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren DICK
> Sent: Wednesday, 3 December 2003 2:39 PM
> To: AccessD List
> Subject: [AccessD] A2K: Number of characters typed into a field.
> 
> 
> Hello all
> I need to see if the number of characters typed in to a field matches a
> pre determined number...say...10. 
> (Data type is irrelevant. Just need to count whatever they type) Using
> the Len() function I can count the 
> number of characters in a text box. No prob. But only after leaving the
> text box 
> I assume 'coz Access doesn't update the contents of the control or
> 'accept' the newly  added contents of 
> a control until you leave that control.
> 
> So.. When I run the sub below in the on Change of a text box it doesn't
> work 'til after I leave the text box.
> 
> Does anyone know how to get it to work with each change or addition of a
> character? (I even had the code going to an unimportant control on the
> form to force the update on each OnChange 
> then got it to return to my text box. This works fine except when I add
> a space to the text I am typing the 
> cursor leaves the control then returns and ignores the space so I can't
> type anything except 1 great big long word)
> 
> Many thanks in advance
> 
> Darren
> 
> eg
> 
> Private Sub ps_CheckExplanationLength()
> 
> Dim intCharsSoFar as integer
> Dim intMinChars as integer
> 
> intMinChars  = 10 ' No of characters typed before enableing apply button
> intCharsSoFar = Len(Me.txtExplanation) ' Typed so far...
> 
> If intCharsSoFar > intMinChars Then
>     Me.cmdApply.Enabled = True ' has met the criteria
> Else
>     Me.cmdApply.Enabled = False 'has not met
> End If
> 
> End Sub
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> 
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


More information about the AccessD mailing list