Repost: Enable cmd in real-time

  • Thread starter Thread starter Antonio
  • Start date Start date
A

Antonio

Hi, everybody, I am trying to enable a command button
when a user starts typing into a text box and disable it
if the user deletes everything from the textbox. Right
now, it's enabled after the user types into and leaves the
text box, but I would like to make it more "real-time".
suggestions?
 
Try experimenting with the KeyDown, KeyPress and KeyUp events of the text
box.
 
In the Change event, it enables the button when I start
typing, but if I delete all the characters, the button
should be disabled.
 
consider also the lost focus and got focus
event....
enable=false when lost and true if ...
 
Private Sub Text5_Change()

Me.Command7.Enabled = (Len(Me.Text5.Text) <> 0)

End Sub

A key point here is to specify the Text property of the control. The Value
property, which is the default property of an Access form control, is not
updated at this stage.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Back
Top