ComboBox

E

Evan

I've created a combobox used in a field. My problem: when I choose an item
from the drop down list or add an item to the combobox all the rows in that
field change to the item last selected. How do I stop this?

Thanks Evan
 
A

Al Campagna

Evan,
That's because the combo box is not "bound" to a field in your table.
The ControlSource for the combo should be set to the field name in your
table that will hold the value selected through the combo.
For example... if you have a field called State in your table, and you
have a combo that allows the user to select a State on your form, then the
ControlSource for the combo would be [State].
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
E

Evan

Thanks Al

The combobox is unbound: The RowsourceType is "List Value" listed in the
Control's RowSource.

Al Campagna said:
Evan,
That's because the combo box is not "bound" to a field in your table.
The ControlSource for the combo should be set to the field name in your
table that will hold the value selected through the combo.
For example... if you have a field called State in your table, and you
have a combo that allows the user to select a State on your form, then the
ControlSource for the combo would be [State].
 
A

Al Campagna

Evan,
Is that a statement, or a question?
The RowSource defines what selections the combo will display.
The ControlSource for the combo indicates what field in your table will
capture the selected value.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Evan said:
Thanks Al

The combobox is unbound: The RowsourceType is "List Value" listed in the
Control's RowSource.

Al Campagna said:
Evan,
That's because the combo box is not "bound" to a field in your table.
The ControlSource for the combo should be set to the field name in
your
table that will hold the value selected through the combo.
For example... if you have a field called State in your table, and
you
have a combo that allows the user to select a State on your form, then
the
ControlSource for the combo would be [State].
 
E

Evan

Its a statement: The RowSource holds the values that are displayed in the
ComboBox. And, I've added a NotInList event to add values as needed. The
problem is that making a selection in the drop-down list for a particular row
changes all the rows in the field.

Thanks for your help. Evan
 
D

Douglas J. Steele

As Al already said, the problem is because your combo box isn't bound.

That's the way continuous forms are.
 
A

Al Campagna

Evan,
That's because you have no field (from your table) "bound" to your
combo box.
The ControlSource (not the RowSource) for the combo indicates what field
in your table will
capture/store the selected value.
For example... if you have a field called State in your table, and you
have a combo that allows the user to select a State on your form, then
the
ControlSource for the combo would be [State].

That way, each record would have it's individual selected value stored
in the table, in the field State.
I can think of no other way to say it... if you want a combo box to
select a particular value, an store that particular value, for each
individual record, it has to be bound to a field.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
E

Evan

Al, didn't realize this before; thanks so much for explaining this to me.

Evan


Evan,
That's because you have no field (from your table) "bound" to your
combo box.
The ControlSource (not the RowSource) for the combo indicates what field
in your table will
capture/store the selected value.
For example... if you have a field called State in your table, and you
have a combo that allows the user to select a State on your form, then
the
ControlSource for the combo would be [State].

That way, each record would have it's individual selected value stored
in the table, in the field State.
I can think of no other way to say it... if you want a combo box to
select a particular value, an store that particular value, for each
individual record, it has to be bound to a field.
 
E

Evan

I created a table with 2 fields: "ID" & "FieldName" to store the values and
bound the field name in the control source but still having a problem. In
form view when I try to click on a value from the drop down list I get
"control can't be edited; Its bound to an unknown field "FieldName" Any
ideas on what I may be doing wrong?
 
A

Al Campagna

Evan,
As to what you are selecting from your combo... is "FieldName" really an
appropriate name?

What table, or query, is the form's Record Source based on?
That's the table that the new field (FieldName) should be added to...
You're creating a new table, related by ID, to your original form table,
but... that shouldn't be necessary.
It should simply be added to the table you already have behind the form.

If your form was based on a table called tblCustomerAddresses, with a
key field called CustomerID... and you wanted to add a field called ZipCode
to your Customer Address form, you wouldn't create a new table for it... you
would just add that ZipCode field to the tblCustomerAddresses table.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
E

Evan

Actually I used the term "fieldname" generically the real name is
"measurement" but I realized that I hadn't included the new table in the
"relationships" once I did that and made the new connections everything works
fine. Once again thanks for all your help. Evan
 
A

Al Campagna

Evan,
If I understand your last post...
I realized that I hadn't included the new table in the "relationships"

The solution was NOT to create a "new table" to hold just 1 value
[Measurement].
Measurement should have neen added to the original table (RowSource) of
the form.

What you've done might "work", but it's not good design practice.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

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