Correct Case

  • Thread starter Thread starter Lez
  • Start date Start date
L

Lez

Hi Guys,

Just wondering if anyone knows how I can force the 1st letter in a field to
be uppercase?

TIA

lez
 
there is an Access built-in function that applies "proper case", meaning the
first letter of every word is capitalized - and all other letters in the
word are lower case. and of course Access has a function to force *all*
upper case letters. but there is no built-in function for anything like
"sentence case" - first letter of every sentence.

you could build your own function, something along the lines of

If Not IsNull(Me!ControlName) Then
Me!ControlName = UCase(Left(Me!ControlName, 1)) _
& Right(Me!ControlName, Len(Me!ControlName)-1)
End If

run the code in the control's AfterUpdate event procedure.

hth
 
Lez said:
Hi Guys,

Just wondering if anyone knows how I can force the 1st letter in a field to
be uppercase?

TIA

lez

1. Put this behind your KeyPress Event for your text box..

Dim strChar As String
If Len(Me.Text0.Text) = 0 Then
strChar = Chr(KeyAscii)
KeyAscii = Asc(UCase(strChar))
End If

2. Change Text0 to the name of your text box.
 
You can use a query to display the name as you want
NewFieldName: StrConv([Fieldname],3)

Or in SQL
Select TableName.* , StrConv([Fieldname],3) As NewFieldName From TableName

************************
You can use StrConv in Code in the AfterUpdate Property of a Control to
affect new date entry. Here is a KB article with an example:

http://support.microsoft.com/?id=253911
 

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

Similar Threads

Access 2007 Developer Pack 5
Command Buttons A2007 2
open form/sub-form 2
Trail Version Access 2007 Download UK version 2
Validation Rule 3
Invoice Numbering 4
runtime upgrdae question 2
upper case letters 4

Back
Top