Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #9241 > unrolled thread

Enabling a Button, Depending on the Contents of Several Fields

Started bycroy <hate@spam.invalid.net>
First post2014-04-04 17:08 -0700
Last post2014-04-05 18:22 -0700
Articles 6 — 4 participants

Back to article view | Back to comp.databases.ms-access


Contents

  Enabling a Button, Depending on the Contents of Several Fields croy <hate@spam.invalid.net> - 2014-04-04 17:08 -0700
    Re: Enabling a Button, Depending on the Contents of Several Fields "Access Developer" <accdevel@gmail.com> - 2014-04-04 21:36 -0500
      Re: Enabling a Button, Depending on the Contents of Several Fields PW <emailaddyinsig@ifIremember.com> - 2014-04-05 11:10 -0600
        Re: Enabling a Button, Depending on the Contents of Several Fields croy <hate@spam.invalid.net> - 2014-04-05 17:23 -0700
        Re: Enabling a Button, Depending on the Contents of Several Fields "Access Developer" <accdevel@gmail.com> - 2014-04-06 20:42 -0500
    Re: Enabling a Button, Depending on the Contents of Several Fields Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-04-05 18:22 -0700

#9241 — Enabling a Button, Depending on the Contents of Several Fields

Fromcroy <hate@spam.invalid.net>
Date2014-04-04 17:08 -0700
SubjectEnabling a Button, Depending on the Contents of Several Fields
Message-ID<hvguj9to8b1jfqmul10nuscnrnb4p4sjq3@4ax.com>
I have several unbound fields that offer a user to set
filter criteria, and buttons to apply the filter criteria,
and clear the criteria.

I've managed to make it so that if a user enters something
in any one of the criteria controls, the buttons become
enabled.

But what if a user enters something, and then changes their
mind and clears the control manually, leaving all the
criteria controls empty?  As it is now, the buttons stay
lit.

What would be the best way to set things up so that if a
user has entered anything in any of the criteria controls
(enabling the buttons), and then manually deletes their
entry, leaving all the criteria controls empty, the buttons
become disabled?

Any thoughts appreciated.

-- 
croy

[toc] | [next] | [standalone]


#9242

From"Access Developer" <accdevel@gmail.com>
Date2014-04-04 21:36 -0500
Message-ID<bq98guFs0o5U1@mid.individual.net>
In reply to#9241
The Lost Focus event should fire when the user moves off that text Control 
after clearing it, and you could place VBA code, or you might check to see 
whether you can put code in the Control's Change event (that'd be the text 
box, also).

 -- 
 Larry Linson
    Co-Author, Microsoft Access Small Business Solutions, Wiley 2010

"croy" <hate@spam.invalid.net> wrote in message 
news:hvguj9to8b1jfqmul10nuscnrnb4p4sjq3@4ax.com...
>I have several unbound fields that offer a user to set
> filter criteria, and buttons to apply the filter criteria,
> and clear the criteria.
>
> I've managed to make it so that if a user enters something
> in any one of the criteria controls, the buttons become
> enabled.
>
> But what if a user enters something, and then changes their
> mind and clears the control manually, leaving all the
> criteria controls empty?  As it is now, the buttons stay
> lit.
>
> What would be the best way to set things up so that if a
> user has entered anything in any of the criteria controls
> (enabling the buttons), and then manually deletes their
> entry, leaving all the criteria controls empty, the buttons
> become disabled?
>
> Any thoughts appreciated.
>
> -- 
> croy 

[toc] | [prev] | [next] | [standalone]


#9244

FromPW <emailaddyinsig@ifIremember.com>
Date2014-04-05 11:10 -0600
Message-ID<p4e0k9p5c3kgpn0t9ma3mrtpg9p1n10nha@4ax.com>
In reply to#9242
On Fri, 4 Apr 2014 21:36:16 -0500, "Access Developer"
<accdevel@gmail.com> wrote:

>The Lost Focus event should fire when the user moves off that text Control 
>after clearing it, and you could place VBA code, or you might check to see 
>whether you can put code in the Control's Change event (that'd be the text 
>box, also).
>
> -- 
> Larry Linson
>    Co-Author, Microsoft Access Small Business Solutions, Wiley 2010

Doesn't the Change Event fire with each key press?  I might be wrong
but I've stayed away from it because of my perhaps incorrect belief!

-paulw

>
>"croy" <hate@spam.invalid.net> wrote in message 
>news:hvguj9to8b1jfqmul10nuscnrnb4p4sjq3@4ax.com...
>>I have several unbound fields that offer a user to set
>> filter criteria, and buttons to apply the filter criteria,
>> and clear the criteria.
>>
>> I've managed to make it so that if a user enters something
>> in any one of the criteria controls, the buttons become
>> enabled.
>>
>> But what if a user enters something, and then changes their
>> mind and clears the control manually, leaving all the
>> criteria controls empty?  As it is now, the buttons stay
>> lit.
>>
>> What would be the best way to set things up so that if a
>> user has entered anything in any of the criteria controls
>> (enabling the buttons), and then manually deletes their
>> entry, leaving all the criteria controls empty, the buttons
>> become disabled?
>>
>> Any thoughts appreciated.
>>
>> -- 
>> croy 
>

[toc] | [prev] | [next] | [standalone]


#9246

Fromcroy <hate@spam.invalid.net>
Date2014-04-05 17:23 -0700
Message-ID<f271k9p0o7gcaqb6k6am75pvtsbku63ibh@4ax.com>
In reply to#9244
On Sat, 05 Apr 2014 11:10:55 -0600, PW
<emailaddyinsig@ifIremember.com> wrote:

>On Fri, 4 Apr 2014 21:36:16 -0500, "Access Developer"
><accdevel@gmail.com> wrote:
>
>>The Lost Focus event should fire when the user moves off that text Control 
>>after clearing it, and you could place VBA code, or you might check to see 
>>whether you can put code in the Control's Change event (that'd be the text 
>>box, also).
>>
>> -- 
>> Larry Linson
>>    Co-Author, Microsoft Access Small Business Solutions, Wiley 2010
>
>Doesn't the Change Event fire with each key press?  I might be wrong
>but I've stayed away from it because of my perhaps incorrect belief!

That is correct.  I know because that is how I get the two
buttons to become enabled the instant the user enters
anything in any of the criteria controls.  That was very
easy, and I think, elegant.

It's when they enter something in one or more of the
criteria controls (especially more), and then change thier
mind and delete it from one, or more, or all of the
controls.  To really make things "clean", there would have
to be code on the Change event that would check all of the
criteria controls for any remaining user input, and only if
the criteria controls were all null or empty, would it then
de-enable the buttons.  That adds a lot to the code, and I'm
just not sure what the best way to code that would be.  I'm
not even sure it's really worth it.

-- 
croy

[toc] | [prev] | [next] | [standalone]


#9248

From"Access Developer" <accdevel@gmail.com>
Date2014-04-06 20:42 -0500
Message-ID<bqee40FfbmU1@mid.individual.net>
In reply to#9244
Yes, "Change" fires on each character... not sure if it fires on, say, a 
backspace keystroke. You can ignore any keystroke that doesn't cause your 
criteria to be met.  I tend to avoid the focus events, because over the 
years, I've thought them to be a little flaky -- that probably just means I 
wasn't fully aware of all their idiosyncracies and they didn't work the way 
I expected them to work.

 -- 
 Larry Linson
    Co-Author, Microsoft Access Small Business Solutions, Wiley 2010

"PW" <emailaddyinsig@ifIremember.com> wrote in message 
news:p4e0k9p5c3kgpn0t9ma3mrtpg9p1n10nha@4ax.com...
> On Fri, 4 Apr 2014 21:36:16 -0500, "Access Developer"
> <accdevel@gmail.com> wrote:
>
>>The Lost Focus event should fire when the user moves off that text Control
>>after clearing it, and you could place VBA code, or you might check to see
>>whether you can put code in the Control's Change event (that'd be the text
>>box, also).
>>
>> -- 
>> Larry Linson
>>    Co-Author, Microsoft Access Small Business Solutions, Wiley 2010
>
> Doesn't the Change Event fire with each key press?  I might be wrong
> but I've stayed away from it because of my perhaps incorrect belief!
>
> -paulw
>
>>
>>"croy" <hate@spam.invalid.net> wrote in message
>>news:hvguj9to8b1jfqmul10nuscnrnb4p4sjq3@4ax.com...
>>>I have several unbound fields that offer a user to set
>>> filter criteria, and buttons to apply the filter criteria,
>>> and clear the criteria.
>>>
>>> I've managed to make it so that if a user enters something
>>> in any one of the criteria controls, the buttons become
>>> enabled.
>>>
>>> But what if a user enters something, and then changes their
>>> mind and clears the control manually, leaving all the
>>> criteria controls empty?  As it is now, the buttons stay
>>> lit.
>>>
>>> What would be the best way to set things up so that if a
>>> user has entered anything in any of the criteria controls
>>> (enabling the buttons), and then manually deletes their
>>> entry, leaving all the criteria controls empty, the buttons
>>> become disabled?
>>>
>>> Any thoughts appreciated.
>>>
>>> -- 
>>> croy
>> 

[toc] | [prev] | [next] | [standalone]


#9247

FromPatrick Finucane <patrickfinucanetx@gmail.com>
Date2014-04-05 18:22 -0700
Message-ID<76290f44-333a-4982-bac0-27d98937c8e5@googlegroups.com>
In reply to#9241
On Friday, April 4, 2014 7:08:38 PM UTC-5, croy wrote:
> I have several unbound fields that offer a user to set
> 
> filter criteria, and buttons to apply the filter criteria,
> 
> and clear the criteria.
> 
> 
> 
> I've managed to make it so that if a user enters something
> 
> in any one of the criteria controls, the buttons become
> 
> enabled.
> 
> 
> 
> But what if a user enters something, and then changes their
> 
> mind and clears the control manually, leaving all the
> 
> criteria controls empty?  As it is now, the buttons stay
> 
> lit.
> 
> 
> 
> What would be the best way to set things up so that if a
> 
> user has entered anything in any of the criteria controls
> 
> (enabling the buttons), and then manually deletes their
> 
> entry, leaving all the criteria controls empty, the buttons
> 
> become disabled?
> 
> 
> 
> Any thoughts appreciated.
> 
> 
> 
> -- 
> 
> croy

Basically I may have several fields in the header I use for filtering.  In each of those fields I have a call to sub SetFilter() in each field's AfterUpdate event. 

In set filter I dim strF as a string then enumerate the filter fields then
  Me.filter = strF
  Me.filterib = (strF > "")

Anyway, in sub SetFilter you can enable/disable controls and do what you want.  This is the tact I'd use.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.databases.ms-access


csiph-web