Subform Requery Failure

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

Guest

Access 2003
Main Form: frmVolunteers displays selected contact information about a
volunteer
- The Control Source for frmVolunteers is tblVolunteers
- VolunteerTaskSubform is the subform control name on
frmVolunteers
for the subform control frame
- cboSelectVolunteer is combo box on Header of frmVolunteers
- the After-Update event for cboSelectVolunteer box has some
code to
generate a new DAO.database with DAO.Querydef which runs
some
VBA code to apply a Union Query definition to the query
qryTaskChoices. This occurs of course every time a
different Volunteer
is selected.

Sub Form: referenced by control VolunteerTaskSubform as noted above
- Source Object for control VolunteerTaskPreferences is
frmPreferredTasks
- subform used in control is frmPreferredTasks
- Record Source for frmPreferredTasks, which is a continuous
form
containing a single text box control, is qryTaskChoices

Worth noting:
The form frmPreferredTasks runs fine when opened independently, and displays
the correct data reflective of the last new volunteer selected via the
cboSelectVolunteer. This means the latest definition for qryTaskChoices is
correct, but never was employed in the prior subform display.

The form frmPreferredTasks has been so designed that the Link Master Fields
and Link Child Fields for the subform control TaskPreferencesSubform are left
blank and not required.

The query qryTaskChoices is always properly defined and functional if
examined after the selection of a new or differnt volunteer via the combo
box.

If the frmVolunteer form is closed and reopened the values for the last
selected volunteer display correctly, even though the form opened with the
default volunteer. As silly as this sounds, I can select a new volunteer,
close the form, re-open the form to the default volunteer, change to the
target volunteer most recently chosen above and all will be well. Obviously
this is not a desired method. This is just further confirmation the
AfterUpdate for cboSelectVolunteer is functioning correctly.

I am aware that I will also need to address the correct display of
frmPreferredTasks for the default volunteer when the form opens. I am
proceeding on this in stages.

My problenm is I cannot get the Requery to properly refresh (or redisplay if
you wish) the correct up-dated data in the subform for the newly selected
Volunteer from the combo box. I have tried all of the following to get a
successful requery, without sucess. They have been placed after DAO code is
run and the 'Set qdf =Nothing' and 'Set df = Nothing' lines. I have also
tried many others permutations which generated errors. These do not cause
errors, but then again don't generate a refreshed result and display it in
the subform. This is the failure I am unhappily acheiving.

Me!TaskPreferencesSubform.Requery
Me!TaskPreferencesSubform.Form.Requery
Me.TaskPreferencesSubform.Form.Requery
[Forms]![frmVolunteers]![TaskPreferencesSubform].Requery
[Forms]![frmVolunteers]![TaskPreferencesSubform].[Form].Requery
Forms!frmVolunteers!TaskPreferencesSubform.Form.Requery

When might it be proper to use instead the,

DoCmd.Requery "appropriate control reference"

method instead of what I have chosen?

Any help or guidance from the learned on my problem would be greatly
appreciated.

Thanks as always.......
 
If TaskPreferencesSubform is a subform of frmVolunteer the following code
will requery the TaskPreferencesSubform

Forms.frmVolunteer.TaskPreferencesSubform.form.requery

Hope this helps

The Grape Hunter said:
Access 2003
Main Form: frmVolunteers displays selected contact information about a
volunteer
- The Control Source for frmVolunteers is tblVolunteers
- VolunteerTaskSubform is the subform control name on
frmVolunteers
for the subform control frame
- cboSelectVolunteer is combo box on Header of frmVolunteers
- the After-Update event for cboSelectVolunteer box has some
code to
generate a new DAO.database with DAO.Querydef which runs
some
VBA code to apply a Union Query definition to the query
qryTaskChoices. This occurs of course every time a
different Volunteer
is selected.

Sub Form: referenced by control VolunteerTaskSubform as noted above
- Source Object for control VolunteerTaskPreferences is
frmPreferredTasks
- subform used in control is frmPreferredTasks
- Record Source for frmPreferredTasks, which is a continuous
form
containing a single text box control, is qryTaskChoices

Worth noting:
The form frmPreferredTasks runs fine when opened independently, and displays
the correct data reflective of the last new volunteer selected via the
cboSelectVolunteer. This means the latest definition for qryTaskChoices is
correct, but never was employed in the prior subform display.

The form frmPreferredTasks has been so designed that the Link Master Fields
and Link Child Fields for the subform control TaskPreferencesSubform are left
blank and not required.

The query qryTaskChoices is always properly defined and functional if
examined after the selection of a new or differnt volunteer via the combo
box.

If the frmVolunteer form is closed and reopened the values for the last
selected volunteer display correctly, even though the form opened with the
default volunteer. As silly as this sounds, I can select a new volunteer,
close the form, re-open the form to the default volunteer, change to the
target volunteer most recently chosen above and all will be well. Obviously
this is not a desired method. This is just further confirmation the
AfterUpdate for cboSelectVolunteer is functioning correctly.

I am aware that I will also need to address the correct display of
frmPreferredTasks for the default volunteer when the form opens. I am
proceeding on this in stages.

My problenm is I cannot get the Requery to properly refresh (or redisplay if
you wish) the correct up-dated data in the subform for the newly selected
Volunteer from the combo box. I have tried all of the following to get a
successful requery, without sucess. They have been placed after DAO code is
run and the 'Set qdf =Nothing' and 'Set df = Nothing' lines. I have also
tried many others permutations which generated errors. These do not cause
errors, but then again don't generate a refreshed result and display it in
the subform. This is the failure I am unhappily acheiving.

Me!TaskPreferencesSubform.Requery
Me!TaskPreferencesSubform.Form.Requery
Me.TaskPreferencesSubform.Form.Requery
[Forms]![frmVolunteers]![TaskPreferencesSubform].Requery
[Forms]![frmVolunteers]![TaskPreferencesSubform].[Form].Requery
Forms!frmVolunteers!TaskPreferencesSubform.Form.Requery

When might it be proper to use instead the,

DoCmd.Requery "appropriate control reference"

method instead of what I have chosen?

Any help or guidance from the learned on my problem would be greatly
appreciated.

Thanks as always.......
 
Unless you are getting an error message, I would say the requery is working
but the lack of master/child fields is hurting you.

1. create/save your qryTaskChoices w/o worrying about the combobox selection.
2. Use the combo box AfterUpdate event to set the filter on frmVolunteers.
3. Use the qryTaskChoices as the recordsource for the subform.
4. Use the master/child link fields on the subform.



The Grape Hunter said:
Access 2003
Main Form: frmVolunteers displays selected contact information about a
volunteer
- The Control Source for frmVolunteers is tblVolunteers
- VolunteerTaskSubform is the subform control name on
frmVolunteers
for the subform control frame
- cboSelectVolunteer is combo box on Header of frmVolunteers
- the After-Update event for cboSelectVolunteer box has some
code to
generate a new DAO.database with DAO.Querydef which runs
some
VBA code to apply a Union Query definition to the query
qryTaskChoices. This occurs of course every time a
different Volunteer
is selected.

Sub Form: referenced by control VolunteerTaskSubform as noted above
- Source Object for control VolunteerTaskPreferences is
frmPreferredTasks
- subform used in control is frmPreferredTasks
- Record Source for frmPreferredTasks, which is a continuous
form
containing a single text box control, is qryTaskChoices

Worth noting:
The form frmPreferredTasks runs fine when opened independently, and displays
the correct data reflective of the last new volunteer selected via the
cboSelectVolunteer. This means the latest definition for qryTaskChoices is
correct, but never was employed in the prior subform display.

The form frmPreferredTasks has been so designed that the Link Master Fields
and Link Child Fields for the subform control TaskPreferencesSubform are left
blank and not required.

The query qryTaskChoices is always properly defined and functional if
examined after the selection of a new or differnt volunteer via the combo
box.

If the frmVolunteer form is closed and reopened the values for the last
selected volunteer display correctly, even though the form opened with the
default volunteer. As silly as this sounds, I can select a new volunteer,
close the form, re-open the form to the default volunteer, change to the
target volunteer most recently chosen above and all will be well. Obviously
this is not a desired method. This is just further confirmation the
AfterUpdate for cboSelectVolunteer is functioning correctly.

I am aware that I will also need to address the correct display of
frmPreferredTasks for the default volunteer when the form opens. I am
proceeding on this in stages.

My problenm is I cannot get the Requery to properly refresh (or redisplay if
you wish) the correct up-dated data in the subform for the newly selected
Volunteer from the combo box. I have tried all of the following to get a
successful requery, without sucess. They have been placed after DAO code is
run and the 'Set qdf =Nothing' and 'Set df = Nothing' lines. I have also
tried many others permutations which generated errors. These do not cause
errors, but then again don't generate a refreshed result and display it in
the subform. This is the failure I am unhappily acheiving.

Me!TaskPreferencesSubform.Requery
Me!TaskPreferencesSubform.Form.Requery
Me.TaskPreferencesSubform.Form.Requery
[Forms]![frmVolunteers]![TaskPreferencesSubform].Requery
[Forms]![frmVolunteers]![TaskPreferencesSubform].[Form].Requery
Forms!frmVolunteers!TaskPreferencesSubform.Form.Requery

When might it be proper to use instead the,

DoCmd.Requery "appropriate control reference"

method instead of what I have chosen?

Any help or guidance from the learned on my problem would be greatly
appreciated.

Thanks as always.......
 
Thanks Steve....

But you obviously failed to read my complete post, as your suggestion of
code was already covered in my post with a notation that it was failing. A
thoughtfull spirit is always a good thing though.

.....The Grape Hunter

Steve Houghton said:
If TaskPreferencesSubform is a subform of frmVolunteer the following code
will requery the TaskPreferencesSubform

Forms.frmVolunteer.TaskPreferencesSubform.form.requery

Hope this helps

The Grape Hunter said:
Access 2003
Main Form: frmVolunteers displays selected contact information about a
volunteer
- The Control Source for frmVolunteers is tblVolunteers
- VolunteerTaskSubform is the subform control name on
frmVolunteers
for the subform control frame
- cboSelectVolunteer is combo box on Header of frmVolunteers
- the After-Update event for cboSelectVolunteer box has some
code to
generate a new DAO.database with DAO.Querydef which runs
some
VBA code to apply a Union Query definition to the query
qryTaskChoices. This occurs of course every time a
different Volunteer
is selected.

Sub Form: referenced by control VolunteerTaskSubform as noted above
- Source Object for control VolunteerTaskPreferences is
frmPreferredTasks
- subform used in control is frmPreferredTasks
- Record Source for frmPreferredTasks, which is a continuous
form
containing a single text box control, is qryTaskChoices

Worth noting:
The form frmPreferredTasks runs fine when opened independently, and displays
the correct data reflective of the last new volunteer selected via the
cboSelectVolunteer. This means the latest definition for qryTaskChoices is
correct, but never was employed in the prior subform display.

The form frmPreferredTasks has been so designed that the Link Master Fields
and Link Child Fields for the subform control TaskPreferencesSubform are left
blank and not required.

The query qryTaskChoices is always properly defined and functional if
examined after the selection of a new or differnt volunteer via the combo
box.

If the frmVolunteer form is closed and reopened the values for the last
selected volunteer display correctly, even though the form opened with the
default volunteer. As silly as this sounds, I can select a new volunteer,
close the form, re-open the form to the default volunteer, change to the
target volunteer most recently chosen above and all will be well. Obviously
this is not a desired method. This is just further confirmation the
AfterUpdate for cboSelectVolunteer is functioning correctly.

I am aware that I will also need to address the correct display of
frmPreferredTasks for the default volunteer when the form opens. I am
proceeding on this in stages.

My problenm is I cannot get the Requery to properly refresh (or redisplay if
you wish) the correct up-dated data in the subform for the newly selected
Volunteer from the combo box. I have tried all of the following to get a
successful requery, without sucess. They have been placed after DAO code is
run and the 'Set qdf =Nothing' and 'Set df = Nothing' lines. I have also
tried many others permutations which generated errors. These do not cause
errors, but then again don't generate a refreshed result and display it in
the subform. This is the failure I am unhappily acheiving.

Me!TaskPreferencesSubform.Requery
Me!TaskPreferencesSubform.Form.Requery
Me.TaskPreferencesSubform.Form.Requery
[Forms]![frmVolunteers]![TaskPreferencesSubform].Requery
[Forms]![frmVolunteers]![TaskPreferencesSubform].[Form].Requery
Forms!frmVolunteers!TaskPreferencesSubform.Form.Requery

When might it be proper to use instead the,

DoCmd.Requery "appropriate control reference"

method instead of what I have chosen?

Any help or guidance from the learned on my problem would be greatly
appreciated.

Thanks as always.......
 
Back
Top