A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Input Mask-Title Case



 
 
Thread Tools Display Modes
  #1  
Old April 3rd, 2007, 06:22 PM posted to microsoft.public.access.tablesdbdesign
winyard
external usenet poster
 
Posts: 8
Default Input Mask-Title Case

Is it possible using the input mask to format all data displayed in a field
to Title Case?
I've seen that you can use:
All characters that follow are converted to lowercase.

All characters that follow are converted to uppercase.


But can find no trace of a symbol to use for Title Case.

Thank you.
  #2  
Old April 3rd, 2007, 07:03 PM posted to microsoft.public.access.tablesdbdesign
fredg
external usenet poster
 
Posts: 4,386
Default Input Mask-Title Case

On Tue, 3 Apr 2007 10:22:09 -0700, winyard wrote:

Is it possible using the input mask to format all data displayed in a field
to Title Case?
I've seen that you can use:
All characters that follow are converted to lowercase.

All characters that follow are converted to uppercase.


But can find no trace of a symbol to use for Title Case.

Thank you.


No you can't... and you don't need to.

Instead, allow entry however the user will.
Code the Control's AfterUpdate event:
Me![ControlName] = StrConv(Me![ControlName],3)

Note: this will improperly capitalize some words which should be all
capitals, or mixed capitals, or no capitals.

ABC becomes Abc
abc becomes Abc
McDonald becomes Mcdonald
O'Connor becomes O'connor
etc.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old April 4th, 2007, 02:06 PM posted to microsoft.public.access.tablesdbdesign
winyard
external usenet poster
 
Posts: 8
Default Input Mask-Title Case

Hi Fred, thanks for the info.
I'm no expert on Access and I'm not clear on where/how I would insert the
code you've inserted?
Thanks again.

"fredg" wrote:

On Tue, 3 Apr 2007 10:22:09 -0700, winyard wrote:

Is it possible using the input mask to format all data displayed in a field
to Title Case?
I've seen that you can use:
All characters that follow are converted to lowercase.

All characters that follow are converted to uppercase.


But can find no trace of a symbol to use for Title Case.

Thank you.


No you can't... and you don't need to.

Instead, allow entry however the user will.
Code the Control's AfterUpdate event:
Me![ControlName] = StrConv(Me![ControlName],3)

Note: this will improperly capitalize some words which should be all
capitals, or mixed capitals, or no capitals.

ABC becomes Abc
abc becomes Abc
McDonald becomes Mcdonald
O'Connor becomes O'connor
etc.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #4  
Old April 4th, 2007, 07:47 PM posted to microsoft.public.access.tablesdbdesign
fredg
external usenet poster
 
Posts: 4,386
Default Input Mask-Title Case

On Wed, 4 Apr 2007 06:06:01 -0700, winyard wrote:

Me![ControlName] = StrConv(Me![ControlName],3)


This must be done on the form used for data entry.
In Form Design View of the form that you are using for data entry,
select the control that you wish to force entry to proper case.
Display that control's property sheet. Click on the Event tab.
On the line that says AfterUpdate, write
[Event Procedure]
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those lines, write:

Me![ControlName] = StrConv(Me![ControlName],3)

Change ControlName to what ever the actual name of that control is.
Save the changes.


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #5  
Old December 9th, 2008, 12:32 PM posted to microsoft.public.access.tablesdbdesign
Chris J[_3_]
external usenet poster
 
Posts: 1
Default Proper case text for McDonald?

Does anyone know of way to apply the proper case format through Word when sending letters to people called McDonald for example?

The best i can get is Mcdonald and not McDonald

Many thanks
  #6  
Old December 9th, 2008, 01:42 PM posted to microsoft.public.access.tablesdbdesign
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Proper case text for McDonald?

On Tue, 09 Dec 2008 04:32:55 -0800, Chris J wrote:

There is no built-in way to do that.
Maybe you could develop a list of exceptions to the standard
vbProperCase.

-Tom.
Microsoft Access MVP



Does anyone know of way to apply the proper case format through Word when sending letters to people called McDonald for example?

The best i can get is Mcdonald and not McDonald

Many thanks

  #7  
Old December 9th, 2008, 03:14 PM posted to microsoft.public.access.tablesdbdesign
Gina Whipp
external usenet poster
 
Posts: 3,500
Default Proper case text for McDonald?

I found this some time ago and might work for you... Just copy into a
Module and be sure not to name the Module the same as any of the Functions.

Option Compare Database
Option Explicit
'This code was originally written by Jay Holovacs.
'It is not to be altered or distributed, except as part of an application.
'You are free to use it in any application, provided the copyright notice is
left unchanged.

'Code Courtesy of Jay Holovacs

Public Function MixedCase(str As Variant) As String
'returns modified string, first character of each word us uppercase all
others lower case
'?MixedCase("joe mcdonald")
Dim ts As String, ps As Integer, char2 As String
If IsNull(str) Then
MixedCase = ""
Exit Function
End If
str = Trim(str) 'added 11/22/98
If Len(str) = 0 Then
MixedCase = ""
Exit Function
End If
ts = LCase$(str)
ps = 1
ps = FirstLetter(ts, ps)
SpecialName ts, 1 'try to fix the beginning
Mid$(ts, 1) = UCase$(Left$(ts, 1))
If ps = 0 Then
MixedCase = ts
Exit Function
End If
While ps 0
If IsRoman(ts, ps) = 0 Then 'not roman, apply the other rules
SpecialName ts, ps
Mid$(ts, ps) = UCase$(Mid$(ts, ps, 1)) 'capitalize the first
letter
End If
ps = FirstLetter(ts, ps)
Wend
MixedCase = ts
End Function
Private Sub SpecialName(str As String, ps As Integer)
'expects str to be a lower case string, ps to be the
'start of name to check, returns str modified in place
'modifies the internal character (not the initial)

Dim char2 As String
char2 = Mid$(str, ps, 2) 'check for Scots Mc
If (char2 = "mc") And Len(str) ps + 1 Then '3rd char is CAP
Mid$(str, ps + 2) = UCase$(Mid$(str, ps + 2, 1))
End If

char2 = Mid$(str, ps, 2) 'check for ff
If (char2 = "ff") And Len(str) ps + 1 Then 'ff form
Mid$(str, ps, 2) = LCase$(Mid$(str, ps, 2))
End If

char2 = Mid$(str, ps + 1, 1) 'check for apostrophe as 2nd char
If (char2 = "'") Then '3rd char is CAP
Mid$(str, ps + 2) = UCase$(Mid$(str, ps + 2, 1))
End If

Dim char3 As String
char3 = Mid$(str, ps, 3) 'check for scots Mac
If (char3 = "mac") And Len(str) ps + 1 Then 'Mac form
Mid$(str, ps + 3) = UCase$(Mid$(str, ps + 3, 1))
End If

Dim char4 As String
char4 = Mid$(str, ps, 4) 'check for Fitz
If (char4 = "fitz") And Len(str) ps + 1 Then 'Fitz form
Mid$(str, ps + 4) = UCase$(Mid$(str, ps + 4, 1))
End If

End Sub
Private Function FirstLetter(str As String, ps As Integer) As Integer
'ps=starting point to search (starts with character AFTER ps)
'returns next first letter, 0 if no more left
'modified 6/18/99 to handle hyphenated names
Dim p2 As Integer, p3 As Integer, s2 As String
s2 = str
p2 = InStr(ps, str, " ") 'points to next blank, 0 if no more
p3 = InStr(ps, str, "-") 'points to next hyphen, 0 if no more
If p3 0 Then
If p2 = 0 Then
p2 = p3
ElseIf p3 p2 Then
p2 = p3
End If
End If
If p2 = 0 Then
FirstLetter = 0
Exit Function
End If
'first move to first non blank, non punctuation after blank
While IsAlpha(Mid$(str, p2)) = False
p2 = p2 + 1
If p2 Len(str) Then 'we ran off the end
FirstLetter = 0
Exit Function
End If
Wend
FirstLetter = p2
End Function
Public Function IsAlpha(ch As String)
'returns true if this is alphabetic character
'false if not
Dim c As Integer
c = Asc(ch)
Select Case c
Case 65 To 90
IsAlpha = True
Case 97 To 122
IsAlpha = True
Case Else
IsAlpha = False
End Select

End Function
Private Function IsRoman(str As String, ps As Integer) As Integer
'starts at position ps, until end of word. If it appears to be
'a roman numeral, than the entire word is capped in passed back
'string, else no changes made in string
'returns 1 if changes were made, 0 if no change
Dim mx As Integer, p2 As Integer, flag As Integer, I As Integer
mx = Len(str) 'just so we don't go off the edge
p2 = InStr(ps, str, " ") 'see if there is another space after this word
If p2 = 0 Then
p2 = mx + 1
End If
'scan to see if any inappropriate characters in this word
flag = 0
For I = ps To p2 - 1
If InStr("ivxIVX", Mid$(str, I, 1)) = 0 Then
flag = 1
End If
Next I
If flag Then
IsRoman = 0
Exit Function 'this is not roman numeral
End If
Mid$(str, ps) = UCase$(Mid$(str, ps, p2 - ps))
IsRoman = 1
End Function


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
Chris J wrote in message ...
Does anyone know of way to apply the proper case format through Word when
sending letters to people called McDonald for example?

The best i can get is Mcdonald and not McDonald

Many thanks



  #8  
Old December 9th, 2008, 03:16 PM posted to microsoft.public.access.tablesdbdesign
John... Visio MVP
external usenet poster
 
Posts: 900
Default Proper case text for McDonald?

And remember to handle that infamous Scottish clans, MacE, MacHine and
MacHinery.

I did it with a custom routine. This is part of the code:
WrdLen = Len(TmpWord)
' Lower case all the letter except the first.
Mid$(TmpWord, 2, WrdLen - 1) = LCase$(Mid$(TmpWord, 2, WrdLen - 1))
' Check for a Mac??? or a Mc????
If WrdLen 4 Then
If Left$(TmpWord, 2) = "Mc" Then Mid$(TmpWord, 3, 1) =
UCase$(Mid$(TmpWord, 3, 1))
If Left$(TmpWord, 3) = "Mac" Then
' Some special words to look out for
If InStr("Mace Machine Machinery", TmpWord) = 0 Then
Mid$(TmpWord, 4, 1) = UCase$(Mid$(TmpWord, 4, 1))
End If
End If
End If

You may also run into issues with Roman Numerals. Bill Gates the Iii

John... Visio MVP

"Tom van Stiphout" wrote in message
...
On Tue, 09 Dec 2008 04:32:55 -0800, Chris J wrote:

There is no built-in way to do that.
Maybe you could develop a list of exceptions to the standard
vbProperCase.

-Tom.
Microsoft Access MVP



Does anyone know of way to apply the proper case format through Word when
sending letters to people called McDonald for example?

The best i can get is Mcdonald and not McDonald

Many thanks




  #9  
Old December 9th, 2008, 03:21 PM posted to microsoft.public.access.tablesdbdesign
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default Proper case text for McDonald?

This seems to be a Word question. If so, it would be best to ask the
question in a Word newsgroup. This group is for discussions about database
structure and design using Microsoft Access.

Chris J wrote in message ...
Does anyone know of way to apply the proper case format through Word when
sending letters to people called McDonald for example?

The best i can get is Mcdonald and not McDonald

Many thanks


  #10  
Old December 9th, 2008, 04:03 PM posted to microsoft.public.access.tablesdbdesign
Gina Whipp
external usenet poster
 
Posts: 3,500
Default Proper case text for McDonald?

Bruce,

smile I guess you're the only one who actually READ the question.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

"BruceM" wrote in message
...
This seems to be a Word question. If so, it would be best to ask the
question in a Word newsgroup. This group is for discussions about
database structure and design using Microsoft Access.

Chris J wrote in message ...
Does anyone know of way to apply the proper case format through Word when
sending letters to people called McDonald for example?

The best i can get is Mcdonald and not McDonald

Many thanks




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.