Update field - reset another field to default

G

Guest

I have set up a form containing Combo boxes that are linked to each other so
that when a option is chosen in field 1 it automatically gives a set of
options in field 2. For example field 1 could be a choice of sports e.g.
Football, Golf, Cricket etc and field 2 could be a choice of venues that are
limited by the first choice. Therefore if football is chosen it would offer
Old Trafford, Anfield etc, but if golf is chosen it would offer Agusta, The
Belfry etc.

My problem is that when I change field 1 it retains the value in field 2 on
screen. When I choose the drop down list it gives the correct list to select
from. How can I update field 2 to a default, once field 1 has been changed?
 
J

Jeff Boyce

David

.... update [combo box 2] to a default..."

First, how will Access know what the proper default is?

One approach would be to add THAT information into the code you already use
in the Combo Box 1 AfterUpdate event to set the list for Combo Box 2.

Regards

Jeff Boyce
<Access MVP>

David said:
I have set up a form containing Combo boxes that are linked to each other so
that when a option is chosen in field 1 it automatically gives a set of
options in field 2. For example field 1 could be a choice of sports e.g.
Football, Golf, Cricket etc and field 2 could be a choice of venues that are
limited by the first choice. Therefore if football is chosen it would offer
Old Trafford, Anfield etc, but if golf is chosen it would offer Agusta, The
Belfry etc.

My problem is that when I change field 1 it retains the value in field 2 on
screen. When I choose the drop down list it gives the correct list to select
from. How can I update field 2 to a default, once field 1 has been
changed?
 
G

Guest

Jeff,

The intention is to set the default as "Choose venue". I have linked the
choices to combo box 1, but when I make a change to combo box 1, the original
choice is retained in combo box 2. When combo box 2 is selected the correct
choice of options are then available by using on click.

The question is how do I reset combo box 2 when combo box 1 is amended?

Jeff Boyce said:
David

.... update [combo box 2] to a default..."

First, how will Access know what the proper default is?

One approach would be to add THAT information into the code you already use
in the Combo Box 1 AfterUpdate event to set the list for Combo Box 2.

Regards

Jeff Boyce
<Access MVP>

David said:
I have set up a form containing Combo boxes that are linked to each other so
that when a option is chosen in field 1 it automatically gives a set of
options in field 2. For example field 1 could be a choice of sports e.g.
Football, Golf, Cricket etc and field 2 could be a choice of venues that are
limited by the first choice. Therefore if football is chosen it would offer
Old Trafford, Anfield etc, but if golf is chosen it would offer Agusta, The
Belfry etc.

My problem is that when I change field 1 it retains the value in field 2 on
screen. When I choose the drop down list it gives the correct list to select
from. How can I update field 2 to a default, once field 1 has been
changed?
 
A

Amy Blankenship

Try in the Combobox OnUpdate to set its ListIndex to 0 or its value to Null.

HTH;

Amy

David said:
Jeff,

The intention is to set the default as "Choose venue". I have linked the
choices to combo box 1, but when I make a change to combo box 1, the
original
choice is retained in combo box 2. When combo box 2 is selected the
correct
choice of options are then available by using on click.

The question is how do I reset combo box 2 when combo box 1 is amended?

Jeff Boyce said:
David

.... update [combo box 2] to a default..."

First, how will Access know what the proper default is?

One approach would be to add THAT information into the code you already
use
in the Combo Box 1 AfterUpdate event to set the list for Combo Box 2.

Regards

Jeff Boyce
<Access MVP>

David said:
I have set up a form containing Combo boxes that are linked to each
other so
that when a option is chosen in field 1 it automatically gives a set of
options in field 2. For example field 1 could be a choice of sports
e.g.
Football, Golf, Cricket etc and field 2 could be a choice of venues
that are
limited by the first choice. Therefore if football is chosen it would offer
Old Trafford, Anfield etc, but if golf is chosen it would offer Agusta, The
Belfry etc.

My problem is that when I change field 1 it retains the value in field
2 on
screen. When I choose the drop down list it gives the correct list to select
from. How can I update field 2 to a default, once field 1 has been
changed?
 
G

Guest

Amy,

I do not understand what you are suggesting that I should do. I have only
before or after update as options in the Combobox & do not know what a
ListIndex is! Can you expand further please.

Amy Blankenship said:
Try in the Combobox OnUpdate to set its ListIndex to 0 or its value to Null.

HTH;

Amy

David said:
Jeff,

The intention is to set the default as "Choose venue". I have linked the
choices to combo box 1, but when I make a change to combo box 1, the
original
choice is retained in combo box 2. When combo box 2 is selected the
correct
choice of options are then available by using on click.

The question is how do I reset combo box 2 when combo box 1 is amended?

Jeff Boyce said:
David

.... update [combo box 2] to a default..."

First, how will Access know what the proper default is?

One approach would be to add THAT information into the code you already
use
in the Combo Box 1 AfterUpdate event to set the list for Combo Box 2.

Regards

Jeff Boyce
<Access MVP>

I have set up a form containing Combo boxes that are linked to each
other
so
that when a option is chosen in field 1 it automatically gives a set of
options in field 2. For example field 1 could be a choice of sports
e.g.
Football, Golf, Cricket etc and field 2 could be a choice of venues
that
are
limited by the first choice. Therefore if football is chosen it would
offer
Old Trafford, Anfield etc, but if golf is chosen it would offer Agusta,
The
Belfry etc.

My problem is that when I change field 1 it retains the value in field
2
on
screen. When I choose the drop down list it gives the correct list to
select
from. How can I update field 2 to a default, once field 1 has been
changed?
 
A

Amy Blankenship

Click on the combobox. Then click on the Visual Basic icon at the top of
your window (Roll over all the icons up there till you see "Code"). Now,
select your combo box from the list at the top of the module window. It
should automatically create a "ComboBoxnn_BeforeUpdate" sub for you. I
don't see an OnUpdate available in the list, but beforeUpdate should work,
and probably AfterUpdate would work, too.

Inside the new sub put

Me.Comboboxyy.value=""

Where Comboboxyy is the other combobox.

HTH;

Amy

David said:
Amy,

I do not understand what you are suggesting that I should do. I have only
before or after update as options in the Combobox & do not know what a
ListIndex is! Can you expand further please.

Amy Blankenship said:
Try in the Combobox OnUpdate to set its ListIndex to 0 or its value to
Null.

HTH;

Amy

David said:
Jeff,

The intention is to set the default as "Choose venue". I have linked
the
choices to combo box 1, but when I make a change to combo box 1, the
original
choice is retained in combo box 2. When combo box 2 is selected the
correct
choice of options are then available by using on click.

The question is how do I reset combo box 2 when combo box 1 is amended?

:

David

.... update [combo box 2] to a default..."

First, how will Access know what the proper default is?

One approach would be to add THAT information into the code you
already
use
in the Combo Box 1 AfterUpdate event to set the list for Combo Box 2.

Regards

Jeff Boyce
<Access MVP>

I have set up a form containing Combo boxes that are linked to each
other
so
that when a option is chosen in field 1 it automatically gives a set
of
options in field 2. For example field 1 could be a choice of sports
e.g.
Football, Golf, Cricket etc and field 2 could be a choice of venues
that
are
limited by the first choice. Therefore if football is chosen it
would
offer
Old Trafford, Anfield etc, but if golf is chosen it would offer
Agusta,
The
Belfry etc.

My problem is that when I change field 1 it retains the value in
field
2
on
screen. When I choose the drop down list it gives the correct list
to
select
from. How can I update field 2 to a default, once field 1 has been
changed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top