Capatilization

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

Guest

I have a field in a form that requires the whole thing to be capitals. Is
there any way apart from using an input mask that would allow me to do that?

thanks
 
Use the AfterUpdate event procedure of the control to convert to upper case:
Me.[Text0] = UCase(Me.[Text0])
Replace Text0 with the name of your text box.

If you want it converted in real type, you could use the control's KeyDown
event.
 
Place a greater-than sign (>) in the field's format (table design view).
You can also format a control in which the text is entered. The text will
appear at first in whatever case the user chooses, but it will be displayed
(and stored) as upper case. To use an input mask I think you need to allow
for the maximum number of characters that could be entered. For instance,
CCCCCCCCCC will allow for up to ten characters and spaces. You can have
fewer, but not more.
 
In
BruceM said:
Place a greater-than sign (>) in the field's format (table design
view). You can also format a control in which the text is entered. The
text will appear at first in whatever case the user chooses, but
it will be displayed (and stored) as upper case.

No, you're mistaken about that. If you use the Format property to force
the text display into upper case, that won't cause the value to be
stored in upper case. It will still be stored in lower or mixed case if
it was entered that way.
 
Thanks Allen that worked great. One last question is there a way to make a
user enter a minimum amount of characters, numbers etc in a certain field
before they are allowed to move to the next field?

Allen Browne said:
Use the AfterUpdate event procedure of the control to convert to upper case:
Me.[Text0] = UCase(Me.[Text0])
Replace Text0 with the name of your text box.

If you want it converted in real type, you could use the control's KeyDown
event.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Blade370 said:
I have a field in a form that requires the whole thing to be capitals. Is
there any way apart from using an input mask that would allow me to do
that?

thanks
 
Dirk Goldgar said:
In

No, you're mistaken about that. If you use the Format property to force
the text display into upper case, that won't cause the value to be stored
in upper case. It will still be stored in lower or mixed case if it was
entered that way.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

The text appeared in upper case when I viewed the table directly, so I
mistakenly stated that it was stored that way.
 
In
BruceM said:
The text appeared in upper case when I viewed the table directly, so I
mistakenly stated that it was stored that way.

If you had the Format property of the field in the table set to ">",
that's the way you'd see it when looking at the table datasheet -- but
it still wouldn't be stored that way.
 
Use the BeforeUpdate event, and could the length of the input:

Private Sub Text0_BeforeUpate(Cancel As Integer)
If Len(Me.Text0) < 12 Then
Cancel = True
MsgBox "Type at least 12 characters, or press Esc to undo."
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Blade370 said:
Thanks Allen that worked great. One last question is there a way to make a
user enter a minimum amount of characters, numbers etc in a certain field
before they are allowed to move to the next field?

Allen Browne said:
Use the AfterUpdate event procedure of the control to convert to upper
case:
Me.[Text0] = UCase(Me.[Text0])
Replace Text0 with the name of your text box.

If you want it converted in real type, you could use the control's
KeyDown
event.

Blade370 said:
I have a field in a form that requires the whole thing to be capitals.
Is
there any way apart from using an input mask that would allow me to do
that?

thanks
 
Brilliant Allen worked a treat. Sorry to be a pest but I have one last
question. On one of my fields I already have a before update event set up to
check that that field matches another one with the code
Private Sub COURSE_CODE_BeforeUpdate(Cancel As Integer)
If Left(Me.[course Code], 2) <> Me.[SCHOOL] Then
MsgBox "Course Code does not match the school code"
Cancel = True
End If
End Sub
How do I nest two bits of code on this event so that I can use the code you
gave me to stipulate a required field length?
As you have already guessed I a do not use VB.

Thanks Again in advance


Allen Browne said:
Use the BeforeUpdate event, and could the length of the input:

Private Sub Text0_BeforeUpate(Cancel As Integer)
If Len(Me.Text0) < 12 Then
Cancel = True
MsgBox "Type at least 12 characters, or press Esc to undo."
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Blade370 said:
Thanks Allen that worked great. One last question is there a way to make a
user enter a minimum amount of characters, numbers etc in a certain field
before they are allowed to move to the next field?

Allen Browne said:
Use the AfterUpdate event procedure of the control to convert to upper
case:
Me.[Text0] = UCase(Me.[Text0])
Replace Text0 with the name of your text box.

If you want it converted in real type, you could use the control's
KeyDown
event.

I have a field in a form that requires the whole thing to be capitals.
Is
there any way apart from using an input mask that would allow me to do
that?

thanks
 
Put both between the Private Sub ... and End Sub lines.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Blade370 said:
Brilliant Allen worked a treat. Sorry to be a pest but I have one last
question. On one of my fields I already have a before update event set up
to
check that that field matches another one with the code
Private Sub COURSE_CODE_BeforeUpdate(Cancel As Integer)
If Left(Me.[course Code], 2) <> Me.[SCHOOL] Then
MsgBox "Course Code does not match the school code"
Cancel = True
End If
End Sub
How do I nest two bits of code on this event so that I can use the code
you
gave me to stipulate a required field length?
As you have already guessed I a do not use VB.

Thanks Again in advance


Allen Browne said:
Use the BeforeUpdate event, and could the length of the input:

Private Sub Text0_BeforeUpate(Cancel As Integer)
If Len(Me.Text0) < 12 Then
Cancel = True
MsgBox "Type at least 12 characters, or press Esc to undo."
End If
End Sub

Blade370 said:
Thanks Allen that worked great. One last question is there a way to
make a
user enter a minimum amount of characters, numbers etc in a certain
field
before they are allowed to move to the next field?

:

Use the AfterUpdate event procedure of the control to convert to upper
case:
Me.[Text0] = UCase(Me.[Text0])
Replace Text0 with the name of your text box.

If you want it converted in real type, you could use the control's
KeyDown
event.

I have a field in a form that requires the whole thing to be
capitals.
Is
there any way apart from using an input mask that would allow me to
do
that?
 
Cheers Allen that worked a treat.

Many Thanks.

Allen Browne said:
Use the BeforeUpdate event, and could the length of the input:

Private Sub Text0_BeforeUpate(Cancel As Integer)
If Len(Me.Text0) < 12 Then
Cancel = True
MsgBox "Type at least 12 characters, or press Esc to undo."
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Blade370 said:
Thanks Allen that worked great. One last question is there a way to make a
user enter a minimum amount of characters, numbers etc in a certain field
before they are allowed to move to the next field?

Allen Browne said:
Use the AfterUpdate event procedure of the control to convert to upper
case:
Me.[Text0] = UCase(Me.[Text0])
Replace Text0 with the name of your text box.

If you want it converted in real type, you could use the control's
KeyDown
event.

I have a field in a form that requires the whole thing to be capitals.
Is
there any way apart from using an input mask that would allow me to do
that?

thanks
 

Ask a Question

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.

Ask a Question

Back
Top