how do I force access to capitilize the text in a field

  • Thread starter Thread starter Guest
  • Start date Start date
Put the following procedure in any standard module in your database:

Public Sub ConvertToCaps(KeyAscii As Integer)
' Converts text typed into control to upper case

Dim strCharacter As String

' Convert ANSI value to character string.
strCharacter = Chr(KeyAscii)
' Convert character to upper case, then to ANSI value.
KeyAscii = Asc(UCase(strCharacter))

End Sub

and in the KeyPress event procedure of any control call it with:

ConvertToCaps KeyAscii
 
I also might suggest reviewing the "StrConv" function. Use the help file to
get more specifics.
This does not necessarily solve your immediate problem. However, if you ever
need to make some conversions to proper casing, Access can handle that too.

HTH

Rob Mastrostefano

--
FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top