ProperCase function for sentences...

RickDB

Registered User.
Local time
Today, 12:29
Joined
Jun 29, 2006
Messages
101
How's it going all,

ProperCase has been a great friend in my db, but I was wondering if there is a way to use ProperCase to clean up Memo Fields. I know this will cause problems with proper nouns and such, but has anyone devised code for this?

Thanks!
 
You could loop through the entry in the MEMO and capitalise each character after a period. But then you run the risk of other reasons to use the same character (numbers, acronyms, etc)
 
So is it best to just get over the people who insist on typing memos with caps lock on? :eek: :D
 
it depends what the memo field is for. If its just internal notes, its probably not the end of the world, although it probably looks irritating. I know loads of people who keep the caps lock on all the while - although I hate it.
 
format the field as all lower case. that should drive the all capitals people crazy enough to put the effort into doing it right. how about a function that scans the text for capitals and if the number of capitals it greater than, let's say, 80%, format the whole thing as lower case. otherwise leave it as it is.

is there any way to check if caps lock is on and, if it is, shut it off?

or better yet, if it is on, display a message that says:

HEY YOU! STUPID! SHUT YOUR CAPS LOCK OFF!

(and if they don't, then format as all lower case. or lock the form until they disable the caps lock)

Just got some help.

On your form, create the label Label0

In the form's module enter:

Option Compare Database
Option Explicit
Private Declare Sub GetKeyboardState Lib "user32" (lpKeyState As Any)
Const VK_CAPITAL = &H14



Public Sub CapsOn()
ReDim Keyboardbuffer(256) As Byte
'Array to check capslock
GetKeyboardState Keyboardbuffer(0)
If Keyboardbuffer(VK_CAPITAL) And 1 Then
'CapsLock on ...
Me.Label0.Caption = "HEY YOU! YEAH YOU! TURN OFF YOUR CAPS LOCK!"
Me.Label0.ForeColor = 255
Me.Label0.Visible = True
End If
End Sub



Private Sub Form_Open(Cancel As Integer)
Call CapsOn
End Sub

Perhaps you could make all the controls on the form invisible and run a 10 second timer to give them time to read the message and then close the form.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom