Forcing capitalization

superrob5

Registered User.
Local time
Today, 17:38
Joined
May 8, 2003
Messages
99
Is there away to foce capitalization on a person name even if there for example
SMITH
SMITH /JONES
 
Create query
UPDATE YourTableName SET PersonName = UCase(PersonName)
 
I am talking about when entering info not viewing it.
 
As far as I know, there's no automatic way to handle it when entering data, you have to write your own routines.

It's not too bad conceptually. Just use the KeyPress event of the control you are working with. Have it check each keystroke and, if it's ascii value is between 97 and 122, it's a lowercase letter from a to z. Just use code to subtract 32 from it to get to the capital letter equivalents. Here's some sample code:

Private Sub txtName_KeyPress(KeyAscii As Integer)
 If KeyAscii >= 97 And KeyAscii <= 122 Then
  DoCmd.CancelEvent
  SendKeys CStr(Chr(KeyAscii - 32))
 End If
End Sub
 
On the KeyPress event of the texbox enter the following code;

KeyAscii = Asc(UCase(Chr$(KeyAscii)))

Dave
 

Users who are viewing this thread

Back
Top Bottom