Lookup Drop down not populating table

  • Thread starter Thread starter Jen Preston via AccessMonster.com
  • Start date Start date
J

Jen Preston via AccessMonster.com

I have a form based on a query. On this form is a drop down to lookup
companyname on a master table that is different from the query. The query
updates my main table, but the drop down of companyname is not populating
the table.

I tried to join the master table to my query, but that just makes the query
NOT updatable. I'm thinking there must be code to move the company name
after the update of the drop-down to the query field.

Can anyone help me with this??
Thanks,
Jen
 
Okay. I see that when I switch the bound column from the companyid to the
companyName, the company name will populate the table but now NOT the
companyid.

Is there a way to bound more than one column??
 
so you have a table with a list of companies, which you use to populate a
combo box droplist. the pertinent fields in tblCompanies are CompanyID and
CompanyName. so far correct? presumably CompanyID is the primary key field
in this table.

you have another table, your main table, that should have a field in it for
CompanyID. this is a foreign key field, meaning it matches the primary key
field in tblCompanies.

if you don't have your tables set up as above, you probably should. the
CompanyID field in both tables must have the same Data Type. if the primary
key field is AutoNumber, then the other field's data type must be Number,
wotj Field Size as Long Integer.

now, go to your data entry form. the combo box's ControlSource should be the
CompanyID field (whatever you named it) from your main table query. in the
combo box's RowSource, you should have at least two fields: CompanyID and
CompanyName. make sure that CompanyID is the bound column. in the
ColumnWidths property, set the width of the CompanyID column to 0". for
instance, say your RowSource is

SELECT CompanyID, CompanyName FROM tblCompanies ORDER BY CompanyName;

then your ColumnWidths property would be set to

0"; 1.5"

now your droplist will show the company names, but the value that is saved
in the main table is the CompanyID, which is correct.

hth
 
Hi Tina,
Thanks for the feedback. My problem is that the companyid is populating,
but NOT the Company Name. Is there a way to populate BOTH the company id
and the company id from the drop down.

Thanks!!
Jen
 
Back
Top