Fill ComboBox in Sub Form Based on Parent Form.

  • Thread starter Thread starter Steve Roberts
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top