473,498 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a script to change first three words of text to uppercase

4 New Member
I want to use an AfterUpdate Event to change the first three words in an Access text field to uppercase. I need suggestions on the correct syntax for the script. thank you.
Nov 25 '13 #1
4 1085
Seth Schrock
2,965 Recognized Expert Specialist
I believe this is what you want.
Expand|Select|Wrap|Line Numbers
  1. Dim strText As String
  2. Dim intLoc As Integer
  3.  
  4. strText = "One Two Three Four Five Six"
  5. intLoc = InStr(InStr(InStr(1, strText, " ") + 1, strText, " ") + 1, strText, " ")
  6. strText = UCase(Left(strText, intLoc)) & Mid(strText, intLoc + 1)
  7. Debug.Print strText
This returns "ONE TWO THREE Four Five Six". All you would have to do is make line 4 be
Expand|Select|Wrap|Line Numbers
  1. strText = Me.ControlName
and then add a line at the end
Expand|Select|Wrap|Line Numbers
  1. Me.ControlName = strText
and you would have it. Just replace ControlName with the name of your control.
Nov 25 '13 #2
zmbd
5,501 Recognized Expert Moderator Expert
Why?
Sounds like a homework problem?

Besides, I'd use the split function, ucase the first three array elements and then rebuild the string.
Nov 25 '13 #3
cjr123
4 New Member
@zmbd
Not homework, its a work-related database. thank you!
Nov 25 '13 #4
cjr123
4 New Member
@Seth Schrock
AWESOME AWESOME AWESOME! Thank you!
Nov 25 '13 #5

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

Similar topics

2
1860
by: Chris Lau | last post by:
What is the best way to compare two entries in a single table where the two fields are "almost" the same? For example, I would like to write a query that would compare the first two words in a...
2
1415
by: anon | last post by:
I am trting to simulate the case available in an excel worksheet where the first three columns are frozen and the rest scroll left and right against this. For example: I have a grid which lists...
9
1411
by: matt | last post by:
is it possible to change a setting, such as Forecolor for all text in a form, or do you have to change it for each text block?
3
6842
by: mahir78 | last post by:
I want to get first 10 words in a column in sql query. (by using space) any help is appreciated
8
4972
by: shapper | last post by:
Hello, I have a string which holds a text. Is it possible to create a substring which uses the first N words of that string? Thanks, Miguel
5
1481
tolkienarda
by: tolkienarda | last post by:
hi all i need to select the first fifteen words of an article stored in a mysql database. so i have the basic idea laid out but the exact syntax seems a bit confusing. i have a book here on...
1
2502
by: saurcurban | last post by:
Hi, Following is the xml file: ------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <wc> Delhi is the capital of India
17
2007
by: Moah Scout | last post by:
Hi there? I have a table say tblChoose with up to 40 records and about 10 fields. I want to choose the first three Records and the forth record on user choise. Eg One user decided to select exactly...
13
6814
by: Sharkiness | last post by:
Morning All, I cannot find the answer to my question anywhere. I have an address field named 'ADDRESS'. I want to run an update query so that the first two words of the address are split into...
0
7163
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,...
1
6884
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
7375
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...
0
5460
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,...
1
4904
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...
0
4586
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...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
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 ...
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.