Combo Box Problem

  • Thread starter Thread starter paul
  • Start date Start date
P

paul

Hi Group

I am trying to create a combo box from a table with 2 fields Name and
Area. The Combo box is set up to select the name as a dropdown list
which then puts that name into the main table. Is there any way of
getting the combo box to also write the Area into the main table when
selecting the name.

I hope I have explained this alright

TIA
 
I am trying to create a combo box from a table with 2 fields Name and
Area. The Combo box is set up to select the name as a dropdown list
which then puts that name into the main table. Is there any way of
getting the combo box to also write the Area into the main table when
selecting the name.

Use the column property of the Combobox to read the data into an unbound
textbox. You really don't need to write it unless the Area will change and
you need to keep a record. (aircode)

Sub cboMyCombo_AfreUpdate()
Me.txtWhatever = Me.cboMyCombo.Column(1)
End Sub

Column (1) will be the 2nd column (zero based array)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Yes, there is a way to get the combo box to write the area to the main table
also. Assuming that those are the only two columns, and that they are in
Name and Area order,you can write data from the Area column by referring to
your control in the afterupdate event of the combobox like this:
Me.Area = Me.MyCombo.Column(1)

This assumes that the control is on a bound form that has the area field of
the main table.
 

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

Back
Top