A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

ucase on change



 
 
Thread Tools Display Modes
  #1  
Old November 1st, 2009, 06:30 PM posted to microsoft.public.access.forms
seeker
external usenet poster
 
Posts: 133
Default ucase on change

I have a textbox that the user wants to have all caps while he types into the
textbox. The following code is in the onchange event for the textbox.

txtNameKey.Text = UCase(txtNameKey.Text)
txtNameKey.SelStart = Len(txtNameKey) + 1

This takes the textbox back to the first letter and overwrites it. I want
it to type the second letter and then third etc. Thanks.
  #2  
Old November 1st, 2009, 06:56 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default ucase on change

"seeker" wrote in message
...
I have a textbox that the user wants to have all caps while he types into
the
textbox. The following code is in the onchange event for the textbox.

txtNameKey.Text = UCase(txtNameKey.Text)
txtNameKey.SelStart = Len(txtNameKey) + 1

This takes the textbox back to the first letter and overwrites it. I want
it to type the second letter and then third etc. Thanks.



I don't think I'd use the Change event for this. How about using the
control's KeyPress event instead, to translate each keystroke as it is
typed:

'------ start of code ------
Private Sub txtNameKey_KeyPress(KeyAscii As Integer)

KeyAscii = Asc(UCase(Chr(KeyAscii)))

End Sub
'------ end of code ------

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #3  
Old November 1st, 2009, 06:56 PM posted to microsoft.public.access.forms
Peter Hibbs
external usenet poster
 
Posts: 871
Default ucase on change

You could try this in the KeyPress event of the Text box :-

KeyAscii = Asc(UCase(Chr(KeyAscii)))

HTH

Peter Hibbs.

On Sun, 1 Nov 2009 10:30:01 -0800, seeker
wrote:

I have a textbox that the user wants to have all caps while he types into the
textbox. The following code is in the onchange event for the textbox.

txtNameKey.Text = UCase(txtNameKey.Text)
txtNameKey.SelStart = Len(txtNameKey) + 1

This takes the textbox back to the first letter and overwrites it. I want
it to type the second letter and then third etc. Thanks.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.