473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to give first letter to be caps

140 100+
hi all

suggest me, how to give first letter of my textfield to caps.

eg. if a person enters a name in the namefield. it should automatically turns to caps
Nov 8 '06 #1
7 2159
PEB
1,418 Expert 1GB
Hi,

Possibly you use a form to enter information in your text field!

If this is the case in the text field properties choose event procedure and type the following code:

Me!TextField=Ucase(left(Me!TextField,1))+mid(Me!Te xtField,2, len(Me!TextField)-1)

You need only to change TextField with the name of yourrespective field name

Copy/Paste it from the name of the procedure that should be:

Sub TextField_AfterUpdate()
Nov 8 '06 #2
NeoPa
32,556 Expert Mod 16PB
Assuming your TextBox is named 'namefield' then try :-
Expand|Select|Wrap|Line Numbers
  1. Private Sub namefield_AfterUpdate()
  2.     namefield = UCase(Left(namefield, 1)) & LCase(Mid(namefield, 2))
  3. End Sub
Excel has a function Proper() which does this but for all words in string, but it's not in Access library.
Nov 8 '06 #3
Tanis
143 100+
Actually, Access does have a proper function, although it is a cconstant.

Private Sub tbName_AfterUpdate()
'Routine is run after tbName text box is updated.

On Error GoTo Err_tbName_AfterUpdate

tbName = Trim(tbName) 'remove preceeding spaces
tbName = StrConv(tbName, vbProperCase) 'convert to proper case


Exit_tbName_AfterUpdate:
Exit Sub

Err_tbName_AfterUpdate:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_tbName_AfterUpdate

End Sub
Nov 8 '06 #4
NeoPa
32,556 Expert Mod 16PB
As Tanis says, use the StrConv() function.
That's a better solution.

NB This will do it for each 'word' in the string rather than just the very first char. I suspect that's what you're after.
Nov 8 '06 #5
missinglinq
3,532 Expert 2GB
This comes up from time to time, and is always a sticky situation when working with proper names, because everyone is not named John Smith! Tanis' solution won't work, for example, with john smith iii or john macsmith or john smith-bradley! It'll yield John Smith Iii, John Macsmith and John Smith-bradley. Here is a link I had squirrelled away from a very good site that addresses these problems:

http://www.mvps.org/access/strings/str0008.htm

As Tanis says, use the StrConv() function.
That's a better solution.

NB This will do it for each 'word' in the string rather than just the very first char. I suspect that's what you're after.
Nov 8 '06 #6
MMcCarthy
14,534 Expert Mod 8TB
This comes up from time to time, and is always a sticky situation when working with proper names, because everyone is not named John Smith! Tanis' solution won't work, for example, with john smith iii or john macsmith or john smith-bradley! It'll yield John Smith Iii, John Macsmith and John Smith-bradley. Here is a link I had squirrelled away from a very good site that addresses these problems:

http://www.mvps.org/access/strings/str0008.htm
Thanks Missinglinq

That's a nice link and going on my favourites list along with some other good mvp sites.

Mary
Nov 9 '06 #7
indhu
140 100+
hi,

thanks for everyone yeah. in inputmask i used >L<gfsdjdkf.
it works fine. any way i 'll use this in coding
Nov 9 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nacho | last post by:
i need to convert the first letter of a veriable to uppercase (the veriable is loaded and the applied LCase() ) thanks -- Nacho
12
by: Alan J. Flavell | last post by:
OK, today's email brought a comment from a reader, pointing out something that I'd long since noticed myself but hadn't done anything about it. On my pages, I've got a first-letter style on...
1
by: Patrick | last post by:
I am trying to get "first-letter" to work inline withing an anchor. Actually I have not been able to get it to work within an <a> tag whether inline, linked, or embedded. Using IE6 service pack 1....
8
by: Mr. B | last post by:
In VB6, I had some code which 'forced' the first character of a string entered to be Capital. For example, if a person was entering their name (john doe)... the code would 'force' --- John Doe. ...
6
by: Fungii | last post by:
Hello, I have a stylesheet that sets p:first-letter to a certain size and colour. I was playing around with Javascript to change paragraph stylesheets using an array like this: var paras =...
3
by: Tegdeep | last post by:
Here's what I want to do: I have a hash table which contains data associated to different keys. The Hash keys are represented by a single character from the keyboard: 0-9, a-z, A-Z, and the...
0
by: Sven Rudolph | last post by:
Hi, I just made a web site and stumbeled upon something, that seems to be a stylesheets bug in Konqueror. When Iuse :first-letter on the a-tag, Konqueror doubles the first letter when I click...
1
blyxx86
by: blyxx86 | last post by:
I have the code to capitalize an entire string when it is input, but would like to capitalize just the first letter of a box, or match the case of a drop down list.. My current code is thus: ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.