counting letters and all caps

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

G'day, i need to find some code that allows me to count the numbe
of characters in a text box so i can recommend an appropriate siz
label to the user. i have had some ideas but they have proven to b
fruitles

Also i would like ALL the text entered on a particular form to be in caps
i am aware of the code to force one object into caps, but is there a shortcu
to spread this across all the objects inthe form

Any help is greatly appreciate

Purny
 
Hi Purny

to answer your first question, the LEN() returns the number of characters

e.g. add the field that you want to count the length of to a query and then
in the next column put in
NewField: Len([Programs])

where Programs is the name of the field you're counting - run the query and
the length will be shown.

Hope this helps
Cheers
JulieD
 
In the BeforeUpdate event of the form, loop through the controls and if the
control is a textbox, change its value to all caps.

Dim ctl As Control
On Error Resume Next
For Each ctl In Me.Controls
If ctl.ControlType = acTextbox Then
ctl.Value = UCase(ctl.Value)
End If
Next

The On Error statement is to ignore the error generated if the textbox isn't
updateable, such as if it is bound to an AutoNumber field. You could also
just trap the error in your error handler if you prefer. If you have other
code and do use the On Error Resume Next, remember to reset your normal
error handler after this routine.
 
Cheers, really appreciate the prompt reply, and so helpfull

Why couldn't i find that in the help?? maybe i couldn'
see the forrest for the trees (as ususal)..

Thanks agai

Purny
 
Back
Top