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