Capital letters in text

Nick SR

New member
Local time
Today, 09:49
Joined
Mar 14, 2005
Messages
6
Hi I'm new round here, and just wondering if anyone could shed some light on a few issues which I am trying to resolve in Access 2000.

Is it possible to make each word start with a capital letter even if the user inputs all the text in lower case,

for example:
user inputs: john smith

Desired display: John Smith


Any help much appreciated

Nick
 
in the after update event of your field put:

strconv([Fieldname], vbProperCase)
 
to do this do i need to write a macro, or can it go in as some kind of vlaidation?
 
In the AfterUpdate event of the textbox, find the button at the far right with three dots on. Click it and select Code Builder to be taken to the VBA Editor.

You'll have something like this:

Code:
Private Sub MyTextBox_AfterUpdate()

End Sub

Between these two lines put:

Code:
If Not IsNull(Me.MyTextBox) Then _
    Me.MyTextBox = StrConv(Me.MyTextBox, vbProperCase)

Replace MyTextBox with the name of your textbox.



HOWEVER,

Since you are talking about inputting a person's name you are advised to create two fields - one called Forename and one called Surname. This is the accepted approach.

The reason?

It's far easier to string two pieces of text together than it is to break one piece of text into two at a variable position (i.e. finding the space in the name). ;)
 
I mite be being really stupid, but I can't find an on update option in the properties of a table, a Form I can, but everything needs to be done in a Table.

Am i being blind

help if you can please

thanks

nick
 
Table

Always use a form - preferably based on a query - to ad, change or delete data.
Working directly in a table, especially when you have others working with the database, is asking for trouble.

Using a form you can control the process, validate data etc.
If you let people work with the table all kinds of unwanted effects may happen.
And by using a form you can design a functional and pleasant looking user interface.
 
Nick SR said:
I can't find an on update option in the properties of a table, a Form I can, but everything needs to be done in a Table.

You never said that. ;)

Tables don't have events. They are strictly for the storing of information. As trucktime says, you shouldn't enter information directly into tables as that is the purpose of forms.

From what you've said I'm willing to bet you have created a non-normalised structure for your database which will also only lead to problems in the future.
 
Rite, took some advice, seperated out first name sur name etc and anything else which was of such a rubiish design (this design was given by lecturer!!!)

But i still want to make the start of each word, appear in capitals within the tables, even if input in lower case.

eg.
dog

should appear

Dog :)

Anyone got any ideas??

nick
 
Nick,

If you are talking about input on a form, you can do effect the input in a number of ways.

I'm sure many people will have other suggestions, but here are mine. Right click the text box (input box) and go to the properties.

1) One of the properties of the text box is input mask (I don't like these very much) you can format the input into the text box to make sure the first letter is in capitals

or

2) In the 'AfterUpdate event' on the same text box your can add some code to effect what has just been inputted. Just what SJ McAbney said.

or

3) Finally, you could have a mess with 'On Change' and maybe 'On Key Press' to see if these events suit your input better. But I usually use AfterUpdate

Otherwise...

If you want to input straight into the Table, go to the design view and select the field e.g. SurName and then one to the properties is like 1) 'Input Mask'
but I nave never used this and I don't know how this might effect forms, queries etc.. later on.

But the syntax is (cut and paste this into the table properties next to inputmask) >L<?????????????

This will make 'dog' into 'Dog' and 'DOG' into 'Dog' :)

Hope this helps


Brett
 
cheers for that fella, got it sorted :)

:)

When using this one, if i have a caption set in the table, do i use the caption or field heading, or a combo of both

if so, which order?

If Not IsNull(Me.MyTextBox) Then _
Me.MyTextBox = StrConv(Me.MyTextBox, vbProperCase)
 
Nick

If you put your code in the afterupdate event of MyTextBox then i don't see why this won't work.

As for captions... I never use them (can't be arsed, same goes for comments in table design, but maybe I should being a profressional and all :D :D :eek: )

I thought they were only used 1)when you select the field off the field list screen it puts the caption into the lable for the text box or
2)look at the data in the table they are used as the column name.

If anyone else knows of a better use for caption, please post :confused:

Regards

Brett
 
Last edited:

Users who are viewing this thread

Back
Top Bottom