Linking a combobox to a subform

Hi

I'm looking to link a combo box to a sub form in access 2010.  there are five columns of data in the sub form and the combo box takes the same data that is in the second column of the sub form. in the sub form I want to only display the data that is related to the number picked out from the combo box rather than all the rows worth of data. how would this be done? 

Hi,

if the combo box is in the main form you can simply set the link properties of the subform control in the main form, i.e. in design view of the main form click once on the subform and in the property sheet set its properties:

Link Master Fields: [HereTheNameOfYourComboBox]

Link Child Fields: [HereTheNameOfTheFieldInTheSubform]

Servus
Karl
-----
Access Developers Conference: http://www.AccessDevCon.com
Acccess-Entwickler-Konferenz: http://www.donkarl.com/?AEK
Access FAQ (de/it): http://www.donkarl.com

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Hi,

if the combo box is in the main form you can simply set the link properties of the subform control in the main form, i.e. in design view of the main form click once on the subform and in the property sheet set its properties:

Link Master Fields: [HereTheNameOfYourComboBox]

Link Child Fields: [HereTheNameOfTheFieldInTheSubform]

Hi Karl

I have done this and comes up with a run time error 2465

Microsoft access cant find the field referred to in the expression

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Hi,

you should reveal the name of the combo box and the field name = control source of the control in the subform (not necessarily equal to the control name) and what exactly you wrote in the link properties (paste it in here).

Servus
Karl
-----
Access Developers Conference: http://www.AccessDevCon.com
Acccess-Entwickler-Konferenz: http://www.donkarl.com/?AEK
Access FAQ (de/it): http://www.donkarl.com

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Hi,

you should reveal the name of the combo box and the field name = control source of the control in the subform (not necessarily equal to the control name) and what exactly you wrote in the link properties (paste it in here).

Hi

the name of the combo box is ToolNumber_Combo.

the name of the subform is dbo_NottsWeek28_subform

there is no control source only row source

the row source is

SELECT [dbo_NottsWeek28 Query].ToolNumber FROM [dbo_NottsWeek28 Query] GROUP BY [dbo_NottsWeek28 Query].ToolNumber;

in the link master fields in data for the subform I have the combo box name and in the link child fields I have the subform.

also now the subform is blank with no table.

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Hi,

it's not clear to me what you have in your subform, i.e. if you use a real form as source object there or just a query. If it is an actual form and if your SQL statement is the record source of this form then try this in the subform's properties:

link master fields: ToolNumber_Combo

link child fields: ToolNumber

Servus
Karl
-----
Access Developers Conference: http://www.AccessDevCon.com
Acccess-Entwickler-Konferenz: http://www.donkarl.com/?AEK
Access FAQ (de/it): http://www.donkarl.com

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Hi,

it's not clear to me what you have in your subform, i.e. if you use a real form as source object there or just a query. If it is an actual form and if your SQL statement is the record source of this form then try this in the subform's properties:

link master fields: ToolNumber_Combo

link child fields: ToolNumber

Hi,

The data from the subform comes from a form based on a query. so the object source of the subform is dbo_NottsWeek28 Form and the row source of the combobox row source is SELECT [dbo_NottsWeek28 Query].ToolNumber FROM [dbo_NottsWeek28 Query] GROUP BY [dbo_NottsWeek28 Query].ToolNumber;

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Is the parent form bound or unbound?  If the latter, you don't really need to use a subform at all.  You can include the combo box in the header of the dbo_NottsWeek28_subform form, and change its RecordSource to a query which references the combo box as a parameter in its WHERE clause, e.g.

    WHERE ToolNumber = Forms!dbo_NottsWeek28_subform!ToolNumber_Combo

In the AfterUpdate event procedure of the combo box requery the form with:

    Me.Requery

You can then open the dbo_NottsWeek28_subform form directly rather than as a subform.
_____________________
Ken Sheridan,
Stafford, England

"Don't write it down until you understand it!" - Richard Feynman

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

 
 

Question Info


Last updated July 18, 2020 Views 3,577 Applies to: