Displaying Subform with a combo-box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have created a form that contains a combo-box and a subform. When the
user selects his/her name from the combo-box, I want the subform to appear
with the information. How do I get the information in the subform to
automatically appear?

Right now, I can select a name from the combo-box but the information does
not appear in the subform. In order to see the information in the subform, I
have had to switch to Datasheet View and then back to Form View. I just want
the information to appear right after a select has been made from the
combo-box.

Please help!!!!
 
Hi, HL.

Is your combo box bound to a field? If it is, then all you are doing when
you select a name in the combo box is starting a new record.

Instead, use an unbound combo box; I often put it in the form header for
convenience and as a visual reminder that is a lookup box not a data entry
field. Then filter the form based on the selection in the combo box'
AfterUpdate event:

Me.Filter = "[YourField]=" & Me.YourComboBox
Me.FilterOn = True

If the form and subform are linked by this field properly, the relevant
detail records will appear with the main form record.

Hope this helps.
Sprinks
 
Sprinks,

Do I place the code below in the AfterUpdate event field for the Form or for
the Subform? Also, when typing the below code, should I use the Expression
builder, Macro Builder, or Code Builder? These options are available when I
go to the After Update event field.

Thanks for your help.

Sprinks said:
Hi, HL.

Is your combo box bound to a field? If it is, then all you are doing when
you select a name in the combo box is starting a new record.

Instead, use an unbound combo box; I often put it in the form header for
convenience and as a visual reminder that is a lookup box not a data entry
field. Then filter the form based on the selection in the combo box'
AfterUpdate event:

Me.Filter = "[YourField]=" & Me.YourComboBox
Me.FilterOn = True

If the form and subform are linked by this field properly, the relevant
detail records will appear with the main form record.

Hope this helps.
Sprinks

HL said:
Hello,

I have created a form that contains a combo-box and a subform. When the
user selects his/her name from the combo-box, I want the subform to appear
with the information. How do I get the information in the subform to
automatically appear?

Right now, I can select a name from the combo-box but the information does
not appear in the subform. In order to see the information in the subform, I
have had to switch to Datasheet View and then back to Form View. I just want
the information to appear right after a select has been made from the
combo-box.

Please help!!!!
 
HL,

Place the combo box in the header of your main form. Use the Code Builder,
which will create the shell of the event procedure for you, and paste the
code between the Sub and End Sub lines.

The code will be run after any change to the value of the control.

Hope that helps.
Sprinks

HL said:
Sprinks,

Do I place the code below in the AfterUpdate event field for the Form or for
the Subform? Also, when typing the below code, should I use the Expression
builder, Macro Builder, or Code Builder? These options are available when I
go to the After Update event field.

Thanks for your help.

Sprinks said:
Hi, HL.

Is your combo box bound to a field? If it is, then all you are doing when
you select a name in the combo box is starting a new record.

Instead, use an unbound combo box; I often put it in the form header for
convenience and as a visual reminder that is a lookup box not a data entry
field. Then filter the form based on the selection in the combo box'
AfterUpdate event:

Me.Filter = "[YourField]=" & Me.YourComboBox
Me.FilterOn = True

If the form and subform are linked by this field properly, the relevant
detail records will appear with the main form record.

Hope this helps.
Sprinks

HL said:
Hello,

I have created a form that contains a combo-box and a subform. When the
user selects his/her name from the combo-box, I want the subform to appear
with the information. How do I get the information in the subform to
automatically appear?

Right now, I can select a name from the combo-box but the information does
not appear in the subform. In order to see the information in the subform, I
have had to switch to Datasheet View and then back to Form View. I just want
the information to appear right after a select has been made from the
combo-box.

Please help!!!!
 
Back
Top