Convert certain text from textbox to uppercase. (1 Viewer)

Zak14

Registered User.
Local time
Today, 02:23
Joined
Jun 27, 2014
Messages
166
I've got an address box on my form. When someone enters 'London' inside the box, I want only 'london' to be changed to all-caps.
 

Zak14

Registered User.
Local time
Today, 02:23
Joined
Jun 27, 2014
Messages
166
Thanks but how would I implement that?
 

MSAccessRookie

AWF VIP
Local time
Yesterday, 21:23
Joined
May 2, 2008
Messages
3,428
I would like to expand on what jdraw said.
  1. You can use the Instr() Function to determine if "London" is found anywhere in the Textbox
  2. You can use the Mid() Function to determine where "London" is found in the Textbox
  3. You can use the UCase() Function to change "London" to "LONDON"
Take time to study all three of these Functions and see what you can come up with on your own.

While I am sure that there are other solutions, this one is straightforward and should give you what you want.


-- Rookie
 

Zak14

Registered User.
Local time
Today, 02:23
Joined
Jun 27, 2014
Messages
166
I would like to expand on what jdraw said.
  1. You can use the Instr() Function to determine if "London" is found anywhere in the Textbox
  2. You can use the Mid() Function to determine where "London" is found in the Textbox
  3. You can use the UCase() Function to change "London" to "LONDON"
Take time to study all three of these Functions and see what you can come up with on your own.

While I am sure that there are other solutions, this one is straightforward and should give you what you want.


-- Rookie

Thanks

I tried this, but it doesn't work.
Code:
Private Sub txtAddress_AfterUpdate()
    If InStr(1, Me.txtAddress, "London") <> 0 Then
        Mid(Me.txtAddress, 1) = UCase("London")
    End If
End Sub
 

MSAccessRookie

AWF VIP
Local time
Yesterday, 21:23
Joined
May 2, 2008
Messages
3,428
It looks like you used the Instr() Function correctly
It looks like you used the UCase() Function correctly.
It looks like you did not use the Mid() Function correctly.

I had another thought in the time since my last reply. A much better Function for you to research might be the Replace() Function. You can use it to do what you are looking for.

-- Rookie
 

Users who are viewing this thread

Top Bottom