473,387 Members | 1,553 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,387 software developers and data experts.

ucase function

I need to define a field so that when a lowercase letter is put in the
field it turns to an uppercase letter. What would the expression for
the field be? My field name is site_id.

Jan 9 '06 #1
7 4581

ts*****@cetusgroup.com wrote:
I need to define a field so that when a lowercase letter is put in the
field it turns to an uppercase letter. What would the expression for
the field be? My field name is site_id.


I use this function. I am sure there may be other methods, but I have
found this to work every time. Call the function in the After Update
event of the site_id text box.

Public Function Capitalize(str As String)

Dim i As Integer
Dim wasspc As Boolean

wasspc = True

For i = 1 To Len(str)
If wasspc Then
str = Left$(str, i - 1) & UCase(Mid(str, i, 1)) & Right(str,
Len(str) - i)
End If
wasspc = IIf(Mid(str, i, 1) = " ", True, False)
Next i

Capitalize = str

End Function

Jan 9 '06 #2


Should I just paste and copy that code into access or do I need to
change anything?

*** Sent via Developersdex http://www.developersdex.com ***
Jan 9 '06 #3


I tried the code you gave me and it did not work. is there anything that
I can do like just create an expression to make the letter in the field
automatically capitalize.

*** Sent via Developersdex http://www.developersdex.com ***
Jan 9 '06 #4

<ts*****@cetusgroup.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I need to define a field so that when a lowercase letter is put in the
field it turns to an uppercase letter. What would the expression for
the field be? My field name is site_id.


The simplest way to do this is in the design of the table, select the field
and into the format property write ">" (without the quotes, ie >).
This will not change the data as lower case letters will still be held in
the table, it just forces them to appear as upper case. If you have to make
sure that no lower case letters are entered into the table, then the only
way is to write code in the form where you enter the data. However, the
solution above is quick, simple and may do all you require.
Jan 9 '06 #5
ts*****@cetusgroup.com wrote:
I need to define a field so that when a lowercase letter is put in the
field it turns to an uppercase letter. What would the expression for
the field be? My field name is site_id.

Do you need to check as the data is input? Why not simply uppercase the
entire field in the afterupdate event of the field. Ex:
Me.Field1 = Ucase(Me.Field1)
Jan 9 '06 #6
<ts*****@cetusgroup.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I need to define a field so that when a lowercase letter is put in the
field it turns to an uppercase letter. What would the expression for
the field be? My field name is site_id.


Two options:

1) In the KeyPress Event:
This option changes data as you type

Private Sub site_id_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

2) In the AfterUpdate Event:
This option changes the entire field after you leave

Private Sub site_id_AfterUpdate
Me.site_id = Ucase(Me.site_id)
End Sub

Fred Zuckerman
Jan 9 '06 #7
<ts*****@cetusgroup.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I need to define a field so that when a lowercase letter is put in the
field it turns to an uppercase letter. What would the expression for
the field be? My field name is site_id.

Todd, I don't know of anything that can force a field in a table to upper
case except for a validation rule (messy). It's easy, however, in a control
on a form. This is what I use for that (note it is the Change event for the
text box):

Private Sub tbxCriteriaValue_Change()
Dim intPos As Integer
intPos = Me.tbxCriteriaValue.SelStart
Me.tbxCriteriaValue = UCase(Me.tbxCriteriaValue.Text)
Me.tbxCriteriaValue.SelStart = intPos
End Sub
--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

Jan 9 '06 #8

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

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
5
by: phil_gg04 | last post by:
Dear Javascript Experts, Opera seems to have different ideas about the visibility of Javascript functions than other browsers. For example, if I have this code: if (1==2) { function...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
2
by: Thomas McK | last post by:
Hi all, I'm trying to make a SQL query (against a table in MS Access) where I want to take the value of something, and check to see if the first two letters in that value are capitalized (for...
12
by: MLH | last post by:
Have had a runtime installation up for 4 months. Upgraded today with new ver 0.07 from 0.06. On launch, error reported... Err in fn Initialize, module AutoExec, function isnt available in query...
5
by: Todd Snyder | last post by:
I need to make a field put uppercase letters in it when a lowercase letter is entered into that field. Is there an expression to use or does it have to be written in code? *** Sent via...
16
by: shawno | last post by:
I'm relatively new to DB2 and have noticed a problem with my queries when doing a like with ucase. Since queries need to be case insensitive, I have to do a ucase on the column(s) being searched...
7
knychtell
by: knychtell | last post by:
Hi there!, i got a problem with classes, can somebody help me with it? i have created a login form(basic login form) with 2 txtboxes and a pair of buttons, how can i use the LCASE or UCASE, the...
6
lee123
by: lee123 | last post by:
how do you change a certsain field to all caps i have tried this statement but didn't work: txtcompanyname.seltext = ucase(txtcompanyname.Seltext) is this correct or what else do i need to add...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.