Solved

Capitalize letter after number

Posted on 2014-04-16
1
400 Views
Last Modified: 2014-04-16
I have a text box and I would like any letter after a number to be capitalized. (123a Gold St -> 123A Gold St) after a user updates the data on the form.

Any suggestions with the best way to handel this in the VBA after update event?
0
Comment
Question by:thandel
1 Comment
 
LVL 1

Accepted Solution

by:
cctanaka earned 500 total points
ID: 40005743
I suggest to create a function to capitalize. Them call this function in the update event.
Let's say the textbox name is "txtdata"

then in the update event

txtdata.text = Capital_After_Numbers(txtdata.text)

--------------------

Function Capital_After_Numbers (texto as string) as string
Dim count as integer
Dim LastCharIsNumber  as boolean


Capital_After_Numbers = ""
LastCharIsNumber = false

For count = 1 to len (texto)

    if LastCharIsNumber then
        Capital_After_Numbers = Capital_After_Numbers & UCase(Mid(texto, count, 1))
    End If

    If asc(Mid(texto, count, 1))>= 48 And asc(Mid(texto, count, 1))<= 57  then
        LastCharIsNumber = True
    else
        LastCharIsNumber = False
    End If

next count

End Function
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question