Forcing Lower Case

P

Paul Richards

I have forms where the default input is all upper case with one field as
an exception.
Is there a way of using an Input mask to force input to lower case and,
if so, how?
 
B

BruceM

You could just put < as the format for the control in which the text
appears. This won't affect how the data is stored, only how it is
displayed. You can use < for an input mask, but I believe you would need to
follow it with something like CCCCCC to the maximum number of spaces or
characters that could appear in the field.
 
P

Powderfinger

Paul Richards said:
I have forms where the default input is all upper case with one field as
an exception.
Is there a way of using an Input mask to force input to lower case and,
if so, how?

Bruce is right in that it won't effect how the field is stored, just
displayed. This could come back to haunt you down the line if you have to
export the db to another application.

I usually handle this by using the function LCase() in the update event of
the field on the form. e.g.,

Private Sub Addr3_AfterUpdate()
If Not IsNull(Me.Addr3) Then Me.Addr3 = LCase(Me.Addr3)
End Sub
 
J

JohnE

Both of the individuals are correct. If you also want to store the info in
all lower case on the table, then in the format of the field on the table you
can also use < which will give you all lower case on the table. In reverse,
will give all upper case.
*** John
 
P

Paul Richards

Thanks guys - I'll give your solutions a try
Both of the individuals are correct. If you also want to store the info in
all lower case on the table, then in the format of the field on the table you
can also use < which will give you all lower case on the table. In reverse,


*** John


:
 
P

Paul Richards

I’ve tried < as an input mask in both table field and form with no
success. I tried your Lcase() code in the After Update event of the
relevant field – but I cannot enter anything into the field now – typing
data into the field doesn’t work as nothing is accepted.

Am I missing something obvious here?
 
B

BruceM

Use < as the format, not as the input mask. An input mask needs to specify
the number of characters and any limitations (such as numbers only). As I
said in my first post, you would need to use something after the < to
specify the number of characters and any limitations (such as letters only,
or numbers only). For instance, <LLLL specifies that four letters are
required; the < makes them lower case. <???? also means four letters, but
they are optional. There are a number of others. However, < by itself
doesn't allow for any entries. Input mask and Format are very different
creatures.
 
P

Paul Richards

OK Bruce, thanks. Any ideas on the LCase issue?
Use < as the format, not as the input mask. An input mask needs to specify
the number of characters and any limitations (such as numbers only). As I
said in my first post, you would need to use something after the < to
specify the number of characters and any limitations (such as letters only,
or numbers only). For instance, <LLLL specifies that four letters are
required; the < makes them lower case. <???? also means four letters, but
they are optional. There are a number of others. However, < by itself
doesn't allow for any entries. Input mask and Format are very different
creatures.
 
B

BruceM

Do you have < by itself in the input mask of either the field or the
control? If so, try removing it. When you say the After Update event of
the relevant field I assume you mean the After Update event of the control
(text box, etc.) bound to the field.
 
P

Paul Richards

Bruce: I have now used < in the Format property of the table and form
field and this achieves lower case as required.

I was putting LCase in the After Update event of the control
 
B

BruceM

That would be a likely place for LCase code, but I think you have discovered
that if you are using < as the format for both the field and the control,
LCase code adds nothing new. You could use LCase code in place of the field
and control format, or to force uppercase in certain situations (new
records, for instance). With the code you don't need to format either the
control or the field. On the other hand, formatting as lower case is pretty
easy.
 
P

Paul Richards

Thanks for the help
That would be a likely place for LCase code, but I think you have discovered
that if you are using < as the format for both the field and the control,
LCase code adds nothing new. You could use LCase code in place of the field
and control format, or to force uppercase in certain situations (new
records, for instance). With the code you don't need to format either the
control or the field. On the other hand, formatting as lower case is pretty
easy.
 
Top