Sub Form lookup / drop down

P

Paul Dennis

I have a form inside another, i.e. a sub form and the two forms are linked by
the [Meeting Number]. The information is correctly stored in the correct
table.

My problem is on one of the fields. It is a dropdown list on another table
[FLUP_RIDER_NAME_HEAT] based on the [Meeting Number].

I have used the code below which always brings the same list up, and doesn't
change when the [Meeting Number] changes on the main form.

If I change Forms![Meeting Heat] to Forms![Meeting Heat1], i.e. it's the
wrong form then when on this field it asks me for the [Meeting Number] again
and the drop down is then correct. Can you help?

SELECT FLUP_RIDER_NAME_HEAT.NAME, FLUP_RIDER_NAME_HEAT.RIDER_ID FROM
FLUP_RIDER_NAME_HEAT WHERE (((FLUP_RIDER_NAME_HEAT.[Meeting
Number])=Forms![Meeting Heat]![Meeting Number]));
 
O

Ofer Cohen

You need to refresh the combo every time the [Meeting Number] field is changed.

On the After Update event of the [Meeting Number] field in the form, you can
write the code

Me.[Combo Name].Requery

If the combo is on the sub form, and the text box on the main form, then
Me.[Sub form control name].Form![Combo Name].Requery

If the combo located on another form
Forms![Form Name]![Combo Name].Requery
 
P

Paul Dennis

Worked a treat - many thanks - saved me a lot of time

Ofer Cohen said:
You need to refresh the combo every time the [Meeting Number] field is changed.

On the After Update event of the [Meeting Number] field in the form, you can
write the code

Me.[Combo Name].Requery

If the combo is on the sub form, and the text box on the main form, then
Me.[Sub form control name].Form![Combo Name].Requery

If the combo located on another form
Forms![Form Name]![Combo Name].Requery

--
Good Luck
BS"D


Paul Dennis said:
I have a form inside another, i.e. a sub form and the two forms are linked by
the [Meeting Number]. The information is correctly stored in the correct
table.

My problem is on one of the fields. It is a dropdown list on another table
[FLUP_RIDER_NAME_HEAT] based on the [Meeting Number].

I have used the code below which always brings the same list up, and doesn't
change when the [Meeting Number] changes on the main form.

If I change Forms![Meeting Heat] to Forms![Meeting Heat1], i.e. it's the
wrong form then when on this field it asks me for the [Meeting Number] again
and the drop down is then correct. Can you help?

SELECT FLUP_RIDER_NAME_HEAT.NAME, FLUP_RIDER_NAME_HEAT.RIDER_ID FROM
FLUP_RIDER_NAME_HEAT WHERE (((FLUP_RIDER_NAME_HEAT.[Meeting
Number])=Forms![Meeting Heat]![Meeting Number]));
 

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