PC Review


Reply
Thread Tools Rate Thread

Change Drop Down List Based on Check Boxes

 
 
=?Utf-8?B?Q29ybmJlZWY=?=
Guest
Posts: n/a
 
      2nd Nov 2007
I have two check boxes, Status and Type, that I want to use as criteria to
change the drop down box of a combo box on the same form.

There are three different scenarios:
Status = True And Type = True - drop down shows only part list 1
Status = False And Type = True - drop down shows only part list 2
Type = False - drop down shows only part list 3

How would I set this up? Thanks in Advance.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TGFuY2U=?=
Guest
Posts: n/a
 
      2nd Nov 2007
Put your lists in a table, with an ID for each list you want to be able to
show.

Pick an applicable event ( click should work ) for the checkboxes, then 3 if
statements checking your conditions. Whenever one of your conditions is met,
set the appropriate SQL in the rowsource property of the combobox.

Something in the nature of:

Me.Combo26.RowSource = "SELECT TEST.Field1 FROM test WHERE (((TEST.Field1) =
1))"

"Cornbeef" wrote:

> I have two check boxes, Status and Type, that I want to use as criteria to
> change the drop down box of a combo box on the same form.
>
> There are three different scenarios:
> Status = True And Type = True - drop down shows only part list 1
> Status = False And Type = True - drop down shows only part list 2
> Type = False - drop down shows only part list 3
>
> How would I set this up? Thanks in Advance.
>
>

 
Reply With Quote
 
=?Utf-8?B?Ym9ibGFyc29u?=
Guest
Posts: n/a
 
      2nd Nov 2007
Actually, you would need to use the AFTER UPDATE event of the checkboxes
because at the CLICK event the value of the checkbox hasn't updated yet and
the old value will still be valid. So, for instance if your checkbox is
false and you click the checkbox and then have code to check the value in the
ON Click event you would see that the value would still be false, but in the
After Update event it would be shown as True.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
__________________________________
If my post was helpful to you, please rate the post.


"Lance" wrote:

> Put your lists in a table, with an ID for each list you want to be able to
> show.
>
> Pick an applicable event ( click should work ) for the checkboxes, then 3 if
> statements checking your conditions. Whenever one of your conditions is met,
> set the appropriate SQL in the rowsource property of the combobox.
>
> Something in the nature of:
>
> Me.Combo26.RowSource = "SELECT TEST.Field1 FROM test WHERE (((TEST.Field1) =
> 1))"
>
> "Cornbeef" wrote:
>
> > I have two check boxes, Status and Type, that I want to use as criteria to
> > change the drop down box of a combo box on the same form.
> >
> > There are three different scenarios:
> > Status = True And Type = True - drop down shows only part list 1
> > Status = False And Type = True - drop down shows only part list 2
> > Type = False - drop down shows only part list 3
> >
> > How would I set this up? Thanks in Advance.
> >
> >

 
Reply With Quote
 
=?Utf-8?B?TGFuY2U=?=
Guest
Posts: n/a
 
      2nd Nov 2007
Click event worked perfectly in the sample form I made, and is returning
identical results as afterupdate. The mousedown function is acting in the
manner you described though.

"boblarson" wrote:

> Actually, you would need to use the AFTER UPDATE event of the checkboxes
> because at the CLICK event the value of the checkbox hasn't updated yet and
> the old value will still be valid. So, for instance if your checkbox is
> false and you click the checkbox and then have code to check the value in the
> ON Click event you would see that the value would still be false, but in the
> After Update event it would be shown as True.
> --
> Bob Larson
> Access World Forums Super Moderator
> Utter Access VIP
> Tutorials at http://www.btabdevelopment.com
> __________________________________
> If my post was helpful to you, please rate the post.
>
>
> "Lance" wrote:
>
> > Put your lists in a table, with an ID for each list you want to be able to
> > show.
> >
> > Pick an applicable event ( click should work ) for the checkboxes, then 3 if
> > statements checking your conditions. Whenever one of your conditions is met,
> > set the appropriate SQL in the rowsource property of the combobox.
> >
> > Something in the nature of:
> >
> > Me.Combo26.RowSource = "SELECT TEST.Field1 FROM test WHERE (((TEST.Field1) =
> > 1))"
> >
> > "Cornbeef" wrote:
> >
> > > I have two check boxes, Status and Type, that I want to use as criteria to
> > > change the drop down box of a combo box on the same form.
> > >
> > > There are three different scenarios:
> > > Status = True And Type = True - drop down shows only part list 1
> > > Status = False And Type = True - drop down shows only part list 2
> > > Type = False - drop down shows only part list 3
> > >
> > > How would I set this up? Thanks in Advance.
> > >
> > >

 
Reply With Quote
 
=?Utf-8?B?Q29ybmJlZWY=?=
Guest
Posts: n/a
 
      5th Nov 2007
I used this following on the afterupdate event of the check boxes and the
gotfocus of the combobox. I added the gotfocus event because I had the form
set as continuous so the user select one check box and then go to a different
combobox and get the wrong input.

Me.RawPart.RowSource = "SELECT PartList.Part FROM PartList WHERE
(((PartList.Status) = Data.Status) AND ((PartList.Type) = Data.Type))"


"Lance" wrote:

> Click event worked perfectly in the sample form I made, and is returning
> identical results as afterupdate. The mousedown function is acting in the
> manner you described though.
>
> "boblarson" wrote:
>
> > Actually, you would need to use the AFTER UPDATE event of the checkboxes
> > because at the CLICK event the value of the checkbox hasn't updated yet and
> > the old value will still be valid. So, for instance if your checkbox is
> > false and you click the checkbox and then have code to check the value in the
> > ON Click event you would see that the value would still be false, but in the
> > After Update event it would be shown as True.
> > --
> > Bob Larson
> > Access World Forums Super Moderator
> > Utter Access VIP
> > Tutorials at http://www.btabdevelopment.com
> > __________________________________
> > If my post was helpful to you, please rate the post.
> >
> >
> > "Lance" wrote:
> >
> > > Put your lists in a table, with an ID for each list you want to be able to
> > > show.
> > >
> > > Pick an applicable event ( click should work ) for the checkboxes, then 3 if
> > > statements checking your conditions. Whenever one of your conditions is met,
> > > set the appropriate SQL in the rowsource property of the combobox.
> > >
> > > Something in the nature of:
> > >
> > > Me.Combo26.RowSource = "SELECT TEST.Field1 FROM test WHERE (((TEST.Field1) =
> > > 1))"
> > >
> > > "Cornbeef" wrote:
> > >
> > > > I have two check boxes, Status and Type, that I want to use as criteria to
> > > > change the drop down box of a combo box on the same form.
> > > >
> > > > There are three different scenarios:
> > > > Status = True And Type = True - drop down shows only part list 1
> > > > Status = False And Type = True - drop down shows only part list 2
> > > > Type = False - drop down shows only part list 3
> > > >
> > > > How would I set this up? Thanks in Advance.
> > > >
> > > >

 
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
Vlookup using a dropdwn list, check different tables based on drop Manny Microsoft Excel Worksheet Functions 2 26th Apr 2009 10:21 PM
Drop down list change to check box =?Utf-8?B?a25vY2s=?= Microsoft Access Forms 1 25th Oct 2007 03:32 AM
Re: change drop down list contents based upon value from another list Doug Robbins Microsoft Word Document Management 0 2nd Aug 2004 08:16 PM
Check boxes in drop-down list Isaac Koch Microsoft Access Forms 1 19th Dec 2003 02:44 PM
Re: Hiding rows containing drop-down list boxes and check boxes Dan E Microsoft Excel Misc 0 11th Jul 2003 07:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:21 PM.