PC Review


Reply
Thread Tools Rate Thread

Dialog Form Enabling OK button

 
 
Tom
Guest
Posts: n/a
 
      26th Oct 2007
Please help with a conceptual problem...

I have an unbound dialog form that I call up for the user to enter a
couple of values that will then be used for some calculations. I
don't want the OK button to enable until all the text boxes are filled
in. Normally, I would include a data check routine that would get
called from the afterupdate event on each text box. If all the text
boxes had a value (that was inside predetermined ranges), the OK
button would be enabled, otherwise not.

Pretty standard stuff...

Now, one pesky user has complained that after he's done entering the
last value the OK button doesn't enable until and unless he tabs off
the last text box. Sure enough, that's the way AfterUpdate works. He
wants it so that immediately upon entering a value in the last text
box, the OK button will enable. I got to say there is a certain logic
to that...

So, I've tried just about every event for the text boxes and form that
I can think of (dirty, keypress, etc), but nothing will fire. What
event should I be using to call the data check routine and enable the
OK button so that it reacts immediately to data entry and doesn't wait
for the user to move off the text box?

Thanks

 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      26th Oct 2007
What you need to do in the AfterUpdate event of the last textbox is enable
the button. Make sure that the button is in the Tab Order just after the
last textbox. (In Design View ... View >>> TabOrder) Then he can hit enter
twice and the button code fires.

The only other event that you can use is the Change event, which will fire
after the first character is typed in the textbox.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Tom" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Please help with a conceptual problem...
>
> I have an unbound dialog form that I call up for the user to enter a
> couple of values that will then be used for some calculations. I
> don't want the OK button to enable until all the text boxes are filled
> in. Normally, I would include a data check routine that would get
> called from the afterupdate event on each text box. If all the text
> boxes had a value (that was inside predetermined ranges), the OK
> button would be enabled, otherwise not.
>
> Pretty standard stuff...
>
> Now, one pesky user has complained that after he's done entering the
> last value the OK button doesn't enable until and unless he tabs off
> the last text box. Sure enough, that's the way AfterUpdate works. He
> wants it so that immediately upon entering a value in the last text
> box, the OK button will enable. I got to say there is a certain logic
> to that...
>
> So, I've tried just about every event for the text boxes and form that
> I can think of (dirty, keypress, etc), but nothing will fire. What
> event should I be using to call the data check routine and enable the
> OK button so that it reacts immediately to data entry and doesn't wait
> for the user to move off the text box?
>
> Thanks
>



 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      26th Oct 2007
Arvin:

Thanks - your first suggestion is what I normally do, but the user
complains that lacks intuitive obviousness (i.e., he thinks that you
shouldn't have to move off the last text box to enable the OK button -
the mere act of entering a valid value in the last text box should
enable the OK button - I can't disagree with that viewpoint).

I tried the Change event, but the problem is that the text box doesn't
have a value yet (because the user hasn't move off it yet) so my data
validation fails. I'd normally just set the form.dirty = false, but
that doesn't work with unbound forms.

So, a slight reposing of the question... How do I get the currently
displayed text in a text box as it is being editted in an unbound form
without moving focus off the text box.

Thanks

 
Reply With Quote
 
germaine.oliver@gmail.com
Guest
Posts: n/a
 
      26th Oct 2007
IIRC, I think the value you're looking for is the .text value... so
ctl.text is the displayed (even if uncommited) value. So have in the
change event for the last control (the one he doesn't want to tab off,
which I don't blame him for).

If ctl.text <180 then me.button.enabled = true

(Obviously, changing names and criteria )

Hope that helps...

On Oct 26, 11:34 am, Tom <rtmn...@swbell.net> wrote:
> Arvin:
>
> Thanks - your first suggestion is what I normally do, but the user
> complains that lacks intuitive obviousness (i.e., he thinks that you
> shouldn't have to move off the last text box to enable the OK button -
> the mere act of entering a valid value in the last text box should
> enable the OK button - I can't disagree with that viewpoint).
>
> I tried the Change event, but the problem is that the text box doesn't
> have a value yet (because the user hasn't move off it yet) so my data
> validation fails. I'd normally just set the form.dirty = false, but
> that doesn't work with unbound forms.
>
> So, a slight reposing of the question... How do I get the currently
> displayed text in a text box as it is being editted in an unbound form
> without moving focus off the text box.
>
> Thanks



 
Reply With Quote
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      27th Oct 2007
You must not have tied the Change event of the textbox. That fires with
every keystroke.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Tom" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Arvin:
>
> Thanks - your first suggestion is what I normally do, but the user
> complains that lacks intuitive obviousness (i.e., he thinks that you
> shouldn't have to move off the last text box to enable the OK button -
> the mere act of entering a valid value in the last text box should
> enable the OK button - I can't disagree with that viewpoint).
>
> I tried the Change event, but the problem is that the text box doesn't
> have a value yet (because the user hasn't move off it yet) so my data
> validation fails. I'd normally just set the form.dirty = false, but
> that doesn't work with unbound forms.
>
> So, a slight reposing of the question... How do I get the currently
> displayed text in a text box as it is being editted in an unbound form
> without moving focus off the text box.
>
> Thanks
>



 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      29th Oct 2007
Thanks - the .text property was the part that I was missing! Never
used that before.

Tom

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call Page Setup Dialog Box From A Button On A Form SQLSQUIRREL Microsoft Access Form Coding 1 28th May 2008 10:00 AM
UI Design Practice(enabling "OK" button of Parent Form) shaily903@rediffmail.com Microsoft Dot NET Framework 0 27th Apr 2005 04:44 AM
Creating / enabling a filter button on a form. =?Utf-8?B?Sm9obg==?= Microsoft Access Form Coding 1 24th Feb 2005 12:39 PM
Form as Dialog with Ok Button on the Form itself Sebastian Microsoft Dot NET Compact Framework 1 12th Jan 2004 09:04 PM
Disabling/Enabling close button on a form Marco Castro Microsoft VB .NET 7 8th Jan 2004 11:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:00 AM.