subforms

  • Thread starter Thread starter Naz
  • Start date Start date
N

Naz

Hi all

I have a form that has 1 bound and 1 unbound combo box on it, and one subform.
I want the subform to display according to what is selected in the either
combo box 1 or 2. The main form and subform do have corresponding fields of
same data type.
I've tried to add the following code to the After Update event of the combo
boxes.

Private Sub choice1_AfterUpdate()

Me!subform_data1.LinkMasterFields = choice1 'the name of the combo box 1
or 2
Me!subform_data2.LinkChildFields = type2 'name of the field on the
subform

End Sub



But it doesn't work....can anyone help me out.

All help is appreciated
 
Hi

I tried that but it doesn't work, i get the message "you cancelled the
previous operation", in debug it highlights the LinkMasterFields line.

Any ideas?
 
Your sample code has two different names there: I would think you'd want the
same name in both places:

Me!subform_data1.LinkMasterFields = "choice1"
Me!subform_data1.LinkChildFields = "type2"

or

Me!subform_data2.LinkMasterFields = "choice1"
Me!subform_data2.LinkChildFields = "type2"
 
Hi - thanks

Yeah thats a mistake it must have happened when i posted the code its not on
their on the actual thing.

still no closer to getting it to work, it must be something small and obvious
 
OK i think i found a way around

I have to make the fields blank first before it accepts the links.

Me!subform_data1.LinkMasterFields = ""
Me!subform_data1.LinkChildFields = ""
Me!subform_data1.LinkMasterFields = "choice1"
Me!subform_data1.LinkChildFields = "type2"

seems to work after that
 
Back
Top