Forcing Uppercase
This tip, Forcing Uppercase, will explain how to force a user to enter uppercase values into a form, whether they do so or not from the key board.
Over the time of using Microsoft Access this query often comes up, as it did for me. I tried numerous options but none of them were satisfactory. This solution is the best I have come up with.
Use the 'Key Press' event for each field and add the following code between the two lines of code created:
KeyAscii = Asc(UCase(Chr(KeyAscii)))
To create the 'Key Press' event, right-click on the field, select properties from the drop-down list and click on the event tab.
Scroll right to the bottom to find the 'Key Press' event, place your cursor next to this event and click on the '...' button that should now appear
Click on ‘Code Builder’ and OK.
This will open the VBE window with your cursor between two lines of code that have been created (as per below or similar):
Paste the code above in between these two lines of code:
Private Sub Surname_KeyPress(KeyAscii As Integer)
End Sub
On the subject of Uppercase – there seems to be a bit of a growing force to eliminate the ‘Caps Lock’ key from the keyboard. I know a lot of my clients, love entering information in capitals and they would be devastated if this was to go. Type the following into your search engine, “removing caps lock keyboardâ€, for lots of articles/chats on this hot topic.