By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,654 Members | 1,811 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,654 IT Pros & Developers. It's quick & easy.

CAPS for Post Code

P: n/a
I would like my Post Code field to be autoformated in CAPS when entered in
the table. How do I do that?
Julian
Aug 13 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Julian wrote:
I would like my Post Code field to be autoformated in CAPS when entered in
the table. How do I do that?
Julian

In the AfterUpdate event of the PostCode (assumes field's name is
PostCOde) you could enter
Me.PostCode = Ucase(Me.PostCode)

Or in the text field, under the data tab for input mask (press F1 in the
input mask row) enter something like
>aaaaa
The lower case a = Letter or digit (entry optional). The uppercases it.

Aug 13 '06 #2

P: n/a
Julian wrote:
I would like my Post Code field to be autoformated in CAPS when entered in
the table. How do I do that?
It's dangerous and unwise to work directly in the Datasheet View of a
Table or Query so let's suppose you are using a form.

This code, in the form's module is based on the premise that that the
PostCode Field is bound to the txtPostCode Control. Its purpose is to
make Windows think you have the shift key pressed down. (Yes, if you
have Caps Lock on, it will make everything you type lower case).

Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As
Byte) As Long
Private Declare Function SetKeyboardState Lib "user32" (pbKeyState As
Byte) As Long
Private Const VK_CAPITAL = &H14
Dim mAKBState(0 To 255) As Byte

Private Sub txtPostCode_GotFocus()
Dim aKBState(0 To 255) As Byte
GetKeyboardState mAKBState(0)
GetKeyboardState aKBState(0)
aKBState(VK_CAPITAL) = aKBState(VK_CAPITAL) Or 1
SetKeyboardState aKBState(0)
End Sub

Private Sub txtPostCode_LostFocus()
SetKeyboardState mAKBState(0)
End Sub

Aug 13 '06 #3

P: n/a
Hi Julian,

You can use this code in the KeyPress event of the PostCode control:
If (KeyAscii >= 97) And (KeyAscii <= 122) then KeyAscii = KeyAscii - 32
All lowercase characters are - at typing - converted to uppercase.

HBInc.
Julian wrote:
I would like my Post Code field to be autoformated in CAPS when entered in
the table. How do I do that?
Julian
Aug 14 '06 #4

P: n/a
Where about do I find KeyPress event? I am a bit of a newbie.
Julian
Aug 15 '06 #5

P: n/a
or
KeyAscii = Asc(UCase(Chr(KeyAscii)))

--

Terry Kreft
"hbinc" <j.********@hccnet.nlwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hi Julian,

You can use this code in the KeyPress event of the PostCode control:
If (KeyAscii >= 97) And (KeyAscii <= 122) then KeyAscii = KeyAscii - 32
All lowercase characters are - at typing - converted to uppercase.

HBInc.
Julian wrote:
I would like my Post Code field to be autoformated in CAPS when entered
in
the table. How do I do that?
Julian

Aug 15 '06 #6

P: n/a
Hi Julian,

I suppose you use a form to enter the PostCode.

Open the form in the develop mode.
Select the PostCode control. In the Proporties of this control you find
the KeyPress event.

HBInc.
Julian wrote:
Where about do I find KeyPress event? I am a bit of a newbie.
Julian
Aug 15 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.