If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Input mask help
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 |
#2
|
|||
|
|||
Input mask help
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? -- Ken Snell MS ACCESS MVP http://www.accessmvp.com/KDSnell/ "Tom" wrote in message ... 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 |
#3
|
|||
|
|||
Input mask help
On Sat, 29 Nov 2008 16:01:01 -0800, Tom wrote:
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 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. -- John W. Vinson [MVP] |
#4
|
|||
|
|||
Input mask help
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 "Ken Snell (MVP)" wrote: 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? -- Ken Snell MS ACCESS MVP http://www.accessmvp.com/KDSnell/ "Tom" wrote in message ... 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 |
#5
|
|||
|
|||
Input mask help
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" wrote: On Sat, 29 Nov 2008 16:01:01 -0800, Tom wrote: 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 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. -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|