473,795 Members | 2,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Upper case and Lower case

75 New Member
Hi fellows

Just a quick question about my database. I have one table in my database which i import it from some other Access db. This table has many fields, such as Initials, Medication name etc....but they are all in different upper case and lower case? Is there a way in Access or VB code so we could change all the current data (in the fields) same Lower case or upper case.

I have this under text box control, and its working fine, but this will effect only on or for new entry on the form. It doesnt effect on the current data in the fields.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Initials_AfterUpdate()
  3.  
  4.     If IsNull(Screen.ActiveControl) = False Then
  5.  
  6.         Screen.ActiveControl = StrConv(Screen.ActiveControl, vbUpperCase)
  7.  
  8.     End If
  9. End Sub
  10.  

any Idea?

Thanks again
Aug 30 '07
15 11556
pukhton
75 New Member
Are you saying the first letter of EACH word in the same field should be capilized for all of your existing data please clarify
yes u got it right.

Thx alot
Aug 31 '07 #11
Jim Doherty
897 Recognized Expert Contributor
yes u got it right.

Thx alot
This will capitalize the first letter of each word. Paste it into a module and save the module whatever you like bas_strings something like that. It is a Function that you can call from your query qrid like this

Capitalize([TheNameOfYourFi eld])

The above line if entered into 'Update To' row of an UPDATE query in the grid will update your data . Remember nothing is perfect..what sequence of characters constitute a word as we know it? beware of anomolies

If you want to see the results before you update (ie: you are not sure) then use it as an extra column in a SELECT query by typing into the Fields row in the grid this:

MyCheck: Capitalize([TheNameOfYourFi eld])

and then run the query as a SELECT query you will then see the differences side by side in datasheet


Expand|Select|Wrap|Line Numbers
  1. Public Function Capitalize(str)
  2.     'This function capitalizes each of the words in a sentence.
  3.     Dim i
  4.     Dim t
  5.     t = LCase(CStr(str))
  6.             If t <> "" And Not IsNull(t) Then
  7.               t = UCase(Mid(t, 1, 1)) & Mid(t, i + 2)
  8.                   For i = 1 To Len(t) - 1
  9.                     If Mid(t, i, 1) = "." Then
  10.                          ' Capitalize words/letters preceded by "."
  11.                          t = Left(t, i) & UCase(Mid(t, i + 1, 1)) & Mid(t, i + 2)
  12.                     End If
  13.                     If Mid(t, i, 2) = Chr(13) + Chr(10) Then
  14.                          ' Capitalize words preceded by carriage return plus
  15.                          ' linefeed combination.
  16.                          t = Left(t, i) & UCase(Mid(t, i + 2, 1)) & Mid(t, i + 3)
  17.                     End If
  18.                     If Mid(t, i, 1) = " " Then
  19.                          ' Capitalize words preceded by a space:
  20.                          t = Left(t, i) & UCase(Mid(t, i + 1, 1)) & Mid(t, i + 2)
  21.                     End If
  22.                   Next
  23.           End If
  24.     Capitalize = t
  25. End Function
Aug 31 '07 #12
JConsulting
603 Recognized Expert Contributor
yes u got it right.

Thx alot
There's been a lot of great work on this thread....but I have to ask. Why do you care what your data in your tables looks like Caps Wise? Access stores data for the sake of content, not looks. That's what forms and reports are for. And you have total control on what the data looks like using the format option. I have to wonder about justifying the time it takes to do this, when in reality, it doesn't matter. Just my .02
J
Sep 1 '07 #13
missinglinq
3,532 Recognized Expert Specialist
Using the native Access function
Expand|Select|Wrap|Line Numbers
  1. strconv(YourFieldName,vbProperCase)
as stated in Post # 5 above, you can replace the 25 line custom function of Post # 12 with
Expand|Select|Wrap|Line Numbers
  1. Public Function Convert2ProperCase(YourField As String) As String
  2. Convert2ProperCase = StrConv(YourField, vbProperCase)
  3. End Function
In your query you would then use
Expand|Select|Wrap|Line Numbers
  1. Convert2ProperCase([YourFieldName])
Or by simply replacing vbUpperCase with its numeric equivalent of 3 (you can't use the VB constant vbUpperCase in a query) you could simply use
Expand|Select|Wrap|Line Numbers
  1. StrConv([YourFieldName],3)
Both will capitalize the first letter of each word in the field, which is the OP’s objective.

Linq ;0)>
Sep 1 '07 #14
missinglinq
3,532 Recognized Expert Specialist
Vis a vis Jconsulting's comments, I think it comes down to would you like to do the formatting once, at the source (read Table) or do it everytime you use the field? If the field appears in 3 forms and 3 reports, you'd have to format it 6 times!

Linq ;0)>
Sep 1 '07 #15
JConsulting
603 Recognized Expert Contributor
Vis a vis Jconsulting's comments, I think it comes down to would you like to do the formatting once, at the source (read Table) or do it everytime you use the field? If the field appears in 3 forms and 3 reports, you'd have to format it 6 times!

Linq ;0)>
>>Linq and All,
That's a good point, and I concede that the option to format text should be controlled once, but through a function that can be re-used. So whether you're entering data directly, or using an update query or import spec, or outputting to a report or displaying in a form, the proper fields can be "filtered" as you go, so there's no after-the-fact cleanup. Taking that into account, the functions included in this thread are well written extremely useful for that purpose. I have added them to my Library! :o)
J
Sep 1 '07 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

4
8691
by: semovrs | last post by:
Hello, everyone! I would appreciate any input or advice on the following quite simple issue: If I search through a file list using grep -E '.*$' it will not pull files ending in JPG and files ending in png which is fine. However, I have some files ending in jpg (note - lower case) and it will not display them either. Why is that? Am I doing something wrong here and if so - what? It obviously is a regexp issue and not a grep issue because...
10
2940
by: David | last post by:
What can I do to accept either uppercase or lower case " y or n" in the program below.? any help will be appreciated #include <iostream> using namespace std; //class definigtion class Pizza {
22
6450
by: DJ | last post by:
Can someone tell me the library call that converts strings to lower case or retrns a new string that is lower case of the original, thanks im using <string> David
17
11229
by: Janice | last post by:
char* line = "abcd"; How to convert the line to upper case and print? Any option for printf to do this? Thanx
4
1793
by: Chris | last post by:
Hi, How can I programatically set Upper, Lower and Normal case on a label or text box controls? Thanks
19
26451
by: Eric Lindsay | last post by:
Should HTML 4.01 Strict markup be done in upper case or in lower case? I understand that HTML allows either upper or lower case. I also notice that XHTML apparently requires lower case. However I saw some mention that the HTML DOM uses upper case for markup elements. So, should I worry about what this means? I am inclined to go with lower case, for two reasons. Easier to change if I subsequently want to use XHTML.
9
2796
by: B Williams | last post by:
I have written some code that will take in a string and print out the reverse, but I also want it to check for upper and lower case and swap them. Will someone assist me? include <iostream> using std::cout; using std::cin; using std::endl; #include <string>
4
5154
by: silversnake | last post by:
Hi , dose one know the code for checking through a string for upper or lower case char's and reverse them of find ? thanks
5
3087
by: cfmx2008 | last post by:
Hi Guys, I hope you could help me to solve this problem. Here it is: I have a huge table of data. Some data are Lower case and some are upper case. these data could be changed by agents, But I want to keep the case. For example: if data is Lower case and it changed to upper case at the time of change it should be lower case again. I know sounds terrible, but this is the problem. any hints will be appreciated. thanks
2
2909
by: vhsb69 | last post by:
WeIrd - my I,O and P keys tyPe Out In uPPercase, everythIng else Is In lOwercase. Keys are nOt stIckIng. Any One gOt any Ideas? Please helP me I am very cOnfused.
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10436
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9040
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.