Fill ComboBox in Sub Form Based on Parent Form.

S

Steve Roberts

I have a form Company that contains a subform sfrmTasks that contains a
combo box that I want to contain the Contacts that are related to the
Company. Is there a way to dynamically fill the combo box based on the
Company in the parent form?

Something like Select * from Contacts where CompanyID = Parent Form
CompanyID

Thanks in advance

Steve
 
T

tina

yes, you just have to refer to the form with the full syntax, in the SELECT
statement, as

Select * from Contacts where CompanyID = Forms!ParentFormName!CompanyID

hth
 
S

Steve Roberts

Tina,

That got them in sync but now when the parent form first opens it prompts me
for the CompanyID. I hit Cancel to bypass and it works. When the form first
opens it does default to a valid company so I assume that the subform
combobox is looking for the Forms!Company!CompanyID before it exists in the
parent form or something like that.

Any idea how to fix it?

Thanks

Steve
 
T

tina

have you tested it beyond that point, to see if the combo box droplist is
populated? and populated appropriately? ...despite the initial parameter
prompt.

hth
 

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