> I need to make a field put uppercase letters in it when a lowercase
> letter is entered into that field. Is there an expression to use or does
> it have to be written in code?
The simplest way to do this is in the design of the table, select the field
and into the format property write ">" (without the quotes, ie >).
This will not change the data as lower case letters will still be held in
the table, it just forces them to appear as upper case. If you have to make
sure that no lower case letters are entered into the table, then the only
way is to write code in the form where you enter the data. However, the
solution above is quick, simple and may do all you require.
Todd Snyder - 09 Jan 2006 17:08 GMT
what would the code be if my field name is site_id.
Geoff G - 10 Jan 2006 11:41 GMT
Further to my previous reply I didn't read your second message so your
after update code would be
Me.[site_id]=UCase(Me.[site_id])
As a point of interest I find it easier to use
SiteID instead of site_id It saves messing about with square brackets
if you have no spaces in object names.
You could try this. I haven't tired it for years; its use should
[probably] belimited to those who feel comfortable with VBA and form's
coding]:
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 txtLastName_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 txtLastName_LostFocus()
SetKeyboardState mAKBState(0)
End Sub
If your text box is called something like txtBox1 then in the after
update event for the box use
Me.txtBox1 = UCase(Me.txtBox1)