Input mask help

T

Tom

si am using access 2003 and I have a field in the table called city
i want to create an input mask to automatically capitalize the first letter
of city names even if they have two parts such as New Cambridge or
North Canton
I know that if i use the input mask as follows
L<????????? that I will get the first word capitalized and the following letter in lower case which is what I want , but how do I indicate the same for a second part of the city name field if one exists ???? any suggestions are greatly appreciated
Thanks in advance
 
K

Ken Snell \(MVP\)

Not doable via input mask if you have a varying length for the first city
word.

You can do it in a form by using the AfterUpdate event of the textbox to
capitalize the first letter of each city word; but it would capitalize the
first letter of EVERY city word (so you'd get London On Thames instead of
London on Thames).

Are you using a form for entering the data?
 
J

John W. Vinson

si am using access 2003 and I have a field in the table called city
i want to create an input mask to automatically capitalize the first letter
of city names even if they have two parts such as New Cambridge or
North Canton
I know that if i use the input mask as follows
Thanks in advance

Input masks simply do not have the power to do this. You'll need to use the
builtin StrConv() function to do this. Are you talking about changing values
in the table already (e.g. the table now contains "new cambridge" or "NEW
CAMBRIDGE") and you want to fix it, or do you want this to change what the
user types as they enter it?

In the former case, run an update query updating City to

StrConv([City], 3)

3 is the code for Proper Case (Every Word Capitalized); 1 converts to lower
case, 2 to UPPER CASE, 4 and higher are for Asian languages - see the online
help.

If you want the data to be converted on the fly as the user enter's data, then
you must (no option) use a Form to enter the data - tables have no usable
events. Use the textbox's AfterUpdate event:

Private Sub City_AfterUpdate()
Me!City = StrConv(Me!City, vbProperCase)
End Sub

vbProperCase is just a constant equal to 3 - you can use the constant in VBA
code but not in a query.
 
T

Tom

yes I am using a form to enter the data . I have used the after update event
for other things but never to do as you suggested. Could you give me an
example of the code to make that work? I really appreciate all your help

Tom
 
T

Tom

Thanks John That did it!1 You really helped me out because I was trying to do
it as the used entered the information originally
Thanks a million
tom

John W. Vinson said:
si am using access 2003 and I have a field in the table called city
i want to create an input mask to automatically capitalize the first letter
of city names even if they have two parts such as New Cambridge or
North Canton
I know that if i use the input mask as follows
Thanks in advance

Input masks simply do not have the power to do this. You'll need to use the
builtin StrConv() function to do this. Are you talking about changing values
in the table already (e.g. the table now contains "new cambridge" or "NEW
CAMBRIDGE") and you want to fix it, or do you want this to change what the
user types as they enter it?

In the former case, run an update query updating City to

StrConv([City], 3)

3 is the code for Proper Case (Every Word Capitalized); 1 converts to lower
case, 2 to UPPER CASE, 4 and higher are for Asian languages - see the online
help.

If you want the data to be converted on the fly as the user enter's data, then
you must (no option) use a Form to enter the data - tables have no usable
events. Use the textbox's AfterUpdate event:

Private Sub City_AfterUpdate()
Me!City = StrConv(Me!City, vbProperCase)
End Sub

vbProperCase is just a constant equal to 3 - you can use the constant in VBA
code but not in a query.
 

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

Top