can I convert to first letter upper case when all are uppercase

G

Guest

i have a table full of data that is uppper case data in a few coloums bu i
wantot t be first leter uppercase and the rest of the road lower case through
out the column
 
D

Douglas J. Steele

Well, I'd hardly call using a few functions "programming". <g>

Where you put it depends on what you want. Do you want to permanently change
the data, or leave it as it is and simply display it as Ullll every time?

To permanently change the data, you could write an Update query that uses
that code to change the data. The SQL would look something like:

UPDATE MyTable
SET MyField = UCase(Left([MyField], 1)) & LCase(Mid([MyField], 2))

Once you've corrected the data already in the table, you might want to put
code in the text box's BeforeUpdate event so that whatever the user inputs
gets corrected before being saved. Assuming the text box on your form is
named txtMyField, you'd end up with something like:

Private Sub txtMyField_BeforeUpdate(Cancel As Integer)

Me.txtMyField = UCase(Left(Me.txtMyField, 1)) & _
LCase(Mid(Me.txtMyField, 2))

End Sub


To leave the data as is, but change how it displays, create a query based on
the existing table. Rather than simply retrieving MyField, use
UCase(Left([MyField], 1)) & LCase(Mid([MyField], 2))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top