Yup, accessing subform from popup question again

S

sml

I'm going nuts! I've googled and googled, but still I can't seem to
access a subform within a mainform from a popup windown.

I have a main_form which contains a sub_form in which a button exists
to delete a record. The button opens up another_form which contains an
option group and depending on which option is selected a sql statement
is created and the docmd.runsql(sql) event is done. All works fine,
but before I leave the popup another_form I would like to requery the
still open sub_form.

I've tried several different versions, but none seem to work. The two
most recommended methods as given below just give me an error that
access "can't find the field 'sub_form' referred to in your
expression"

' Neither of these work!
Forms!mainForm_name!subform_name.Form.Requery
Forms!mainForm_name!subform_name.Requery

I've doubled checked the names and I can find no typos ... so is there
anything else that I'm missing?

Thanks!
 
M

Marshall Barton

I'm going nuts! I've googled and googled, but still I can't seem to
access a subform within a mainform from a popup windown.

I have a main_form which contains a sub_form in which a button exists
to delete a record. The button opens up another_form which contains an
option group and depending on which option is selected a sql statement
is created and the docmd.runsql(sql) event is done. All works fine,
but before I leave the popup another_form I would like to requery the
still open sub_form.

I've tried several different versions, but none seem to work. The two
most recommended methods as given below just give me an error that
access "can't find the field 'sub_form' referred to in your
expression"

' Neither of these work!
Forms!mainForm_name!subform_name.Form.Requery
Forms!mainForm_name!subform_name.Requery

I've doubled checked the names and I can find no typos ... so is there
anything else that I'm missing?


Forms!mainForm_name!subform_name.Form.Requery
is the correct syntax.

The trick is to replace mainForm_name with the name of the
form in the database window (on the Forms tab). And replace
subform_name with the name of the subform control on the
main form. The subform control might or might not have the
same name as the form object that's displayed.
 
S

sml

Forms!mainForm_name!subform_name.Form.Requery
is the correct syntax.

The trick is to replace mainForm_name with the name of the
form in the database window (on the Forms tab).  And replace
subform_name with the name of the subform control on the
main form.  The subform control might or might not have the
same name as the form object that's displayed.

Thank YOU! The subform control name was different from the subform
form name. It now works as desired. :)
 

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