PC Review


Reply
Thread Tools Rate Thread

options on list box conditional on whats entered in another contro

 
 
=?Utf-8?B?VGltIENvbGJvdXJu?=
Guest
Posts: n/a
 
      8th Aug 2007
Hi,

I'm trying (and failing) to make the available options on a list box control
conditional on what is entered into another control (which also happens to be
a list box). I've been trying to use the macro action ApplyFilter (and have
made queries that should restrict the options in the list box) but this seems
to want to filter the records rather than the options of the list box.
The options in the list box are taken from a separate table. The query used
for the filter then applies to this table, but the macro doesn't work as
planned.

In detail the macro is as follows it is liked to the OnClick property of the
control [distict]:

Conditon [district]=Kasungu Action Apply Filter: Health facilities in
Kasungu (this is a query that applies to the table 'All Health Facilities'
and has the 'show' button ticked for the criteria Dist="K")
Conditon [district]=Lilongwe Action Apply Filter: Health facilities in
Lilongwe (this is a query that applies to the table 'All Health Facilities'
and has the 'show' button ticked for the criteria Dist="L")
Conditon [district]=Salima Action Apply Filter: Health facilities in Salima
(this is a query that applies to the table 'All Health Facilities' and has
the 'show' button ticked for the criteria Dist="S")

Can you help me?

Tim
 
Reply With Quote
 
 
 
 
Steve Schapel
Guest
Posts: n/a
 
      9th Aug 2007
Tim,

The ApplyFilter action is not the applicable action in this case.

One option would be to use SetValue actions, where you would set the
value of the RowSource property of the second listbox, to the query that
defines each district setting. In any case, you would have to use text
delimiter characters in the Condition statement, e.g.
[district]="Kasungu"

However, it would probably be a lot easier to just have one query for
the Row Source of the second listbox, and then in the criteria of the
query, instead of "hard-coding" the value, reference the value of the
first listbox, using syntax such as:
[Forms]![NameOfYourForm]![District]
.... or whatever.

Then, you can simply use a macro with one action: Requery (to apply to
the second listbox).

--
Steve Schapel, Microsoft Access MVP

Tim Colbourn wrote:
> Hi,
>
> I'm trying (and failing) to make the available options on a list box control
> conditional on what is entered into another control (which also happens to be
> a list box). I've been trying to use the macro action ApplyFilter (and have
> made queries that should restrict the options in the list box) but this seems
> to want to filter the records rather than the options of the list box.
> The options in the list box are taken from a separate table. The query used
> for the filter then applies to this table, but the macro doesn't work as
> planned.
>
> In detail the macro is as follows it is liked to the OnClick property of the
> control [distict]:
>
> Conditon [district]=Kasungu Action Apply Filter: Health facilities in
> Kasungu (this is a query that applies to the table 'All Health Facilities'
> and has the 'show' button ticked for the criteria Dist="K")
> Conditon [district]=Lilongwe Action Apply Filter: Health facilities in
> Lilongwe (this is a query that applies to the table 'All Health Facilities'
> and has the 'show' button ticked for the criteria Dist="L")
> Conditon [district]=Salima Action Apply Filter: Health facilities in Salima
> (this is a query that applies to the table 'All Health Facilities' and has
> the 'show' button ticked for the criteria Dist="S")

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VGltIENvbGJvdXJu?=
Guest
Posts: n/a
 
      9th Aug 2007
Thanks Steve,
The second method worked fine!
Tim

"Steve Schapel" wrote:

> Tim,
>
> The ApplyFilter action is not the applicable action in this case.
>
> One option would be to use SetValue actions, where you would set the
> value of the RowSource property of the second listbox, to the query that
> defines each district setting. In any case, you would have to use text
> delimiter characters in the Condition statement, e.g.
> [district]="Kasungu"
>
> However, it would probably be a lot easier to just have one query for
> the Row Source of the second listbox, and then in the criteria of the
> query, instead of "hard-coding" the value, reference the value of the
> first listbox, using syntax such as:
> [Forms]![NameOfYourForm]![District]
> .... or whatever.
>
> Then, you can simply use a macro with one action: Requery (to apply to
> the second listbox).
>
> --
> Steve Schapel, Microsoft Access MVP
>
> Tim Colbourn wrote:
> > Hi,
> >
> > I'm trying (and failing) to make the available options on a list box control
> > conditional on what is entered into another control (which also happens to be
> > a list box). I've been trying to use the macro action ApplyFilter (and have
> > made queries that should restrict the options in the list box) but this seems
> > to want to filter the records rather than the options of the list box.
> > The options in the list box are taken from a separate table. The query used
> > for the filter then applies to this table, but the macro doesn't work as
> > planned.
> >
> > In detail the macro is as follows it is liked to the OnClick property of the
> > control [distict]:
> >
> > Conditon [district]=Kasungu Action Apply Filter: Health facilities in
> > Kasungu (this is a query that applies to the table 'All Health Facilities'
> > and has the 'show' button ticked for the criteria Dist="K")
> > Conditon [district]=Lilongwe Action Apply Filter: Health facilities in
> > Lilongwe (this is a query that applies to the table 'All Health Facilities'
> > and has the 'show' button ticked for the criteria Dist="L")
> > Conditon [district]=Salima Action Apply Filter: Health facilities in Salima
> > (this is a query that applies to the table 'All Health Facilities' and has
> > the 'show' button ticked for the criteria Dist="S")

>

 
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
Combo box list based on information entered in another combo box Wayne Microsoft Access Forms 2 16th Apr 2009 07:48 PM
What are my options for implementing a horizontal drag/drop contro =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= Microsoft Dot NET Framework Forms 3 27th Sep 2007 02:47 PM
Loading user control when a link is clicked on another user contro =?Utf-8?B?U3JpZGhhcg==?= Microsoft ASP .NET 1 18th Nov 2005 04:00 AM
How do you move a certificate authority to a another domain contro =?Utf-8?B?QW5kcmV3IEJ1c2NoYm9t?= Microsoft Windows 2000 3 15th Oct 2004 06:18 PM
Move to next contro box. sigh Microsoft Access Forms 0 24th Nov 2003 06:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:10 PM.