Bound means the control has the name of a field in the form's record source
in its Control Sourece property so that it displays the fields value of the
current record and if you change the value in the control, the field in the
table is updated.
Unbound means the control does not have a record source field in the Control
Sourece property and does not display or update a field in the from's record
source.
What you are wanting to do is very common.
Customer ID should be a text box. It is best not to use Spaces in names.
Let's name it txtCustomerID.
Company Name should be a Combo box (drop down). Let's name it cboCompany
Here is how you show only the company name to the user, but put the Customer
ID value in the text box.
First let's set up the Combo's properties like they need to be.
Row Source Type: Table/Query
Row Source: SELECT [Customer ID], [Company Name] FROM [Customer Table];
Column Count: 2
Column Widths: 0"; 2" (The 0" will hide the customer id, make the 2" however
wide
it nees to be to show the company name)
Bound Column: 1 (This can be confusing. It is not the same as a bound
column. It
just defines which column of the combo's row
source will be
returned as the combo's value)
Now, in the Combo's After Update, you populate the txtCustomerID control
with the value in the Combo's first column:
Me.txtCustomerID = Me.cboCompany
My names may not be exactly the same as yours, so you can change the names I
used to use your actual names.
--
Dave Hargis, Microsoft Access MVP
Candace said:
I have followed what you have said and it is still not working...now I have
my combo box listing both fields that appear in my Custombers table and not
having just the name to select and the Customer ID populating to the previous
field.
I am not sure what you mean by "bound" either...
My Form is setup as follows:
Customer ID (#): is currently a drop down box...am not sure if this has any
weight on the issue, maybe s/b a txt. field?
Company Name: is also a drop down box that pulls from the Customer Table (2
columns, Customer ID and Company Name)
I want to select the Company name and then then Customer ID will
populate...I thought that I could do this by building an expression but can't
seem to get that to work either...I didn't realize it was this difficult to
link 2 fields that exist in the same table???
:
You did not say how you are trying to do this, so I will offer a few things
to check.
Based on your post, I assume the Combo is an unbound control and you have a
control bound to the Customer ID you are trying to populate based on the
selection from the Combo.
First, you Combo's row source should be something like:
SELECT CustomerID, CustomerName FROM tblCustomer ORDER BY CustomerName;
The Bound Column property should be 1
The Column Count property should be 2
You should use the Combo's After Update event to populate the bound control
Me.txtCustomerID = Me.cboCustomerSearch
The names are made up, you will need to use your actual field and control
names.
--
Dave Hargis, Microsoft Access MVP
:
I have reviewed the solutions as suggested in the forum but am unable to make
the autopopulate function work in my form.
I have a single combo box that runs off a customers table that consists of 2
columns, Customer ID (Number format) and the Company Name.
I need to have the company name selected from the combo box and then the
Customer ID# populate within the form field and cannot get this to work.
Please assist. (Beginner user)
Candace