subform-on Main form not refreshing queried job list

B

babs

I am reposting - haven't gotten answer yet??? any ideas-Thanks!

I have a subform for jobs to be at list - when I am int the actual form it
requeries and shows only the ones checked off - when I go to the mainform
with the jobs to be at list as a subform - it does not refresh or requery
unless I close and open back up again. I had added a refresh command button
with the following code:
DoCmd.RunCommand acCmdRefresh
when i press the refresh button it refreshes the job list to be at

I add this code to the Onload of the Main form - don't want user to have to
press refresh button but it doesn't refresh jobs to be at list unless press
refresh or close and open - added requery all over the place on load and on
open of all main and subforms.

what am i missing???
Barb
 
J

John Spencer

You need to requery the subform on the main form.

Forms![NameOfMainForm]![NameofSubFormC*O*N*T*R*O*L*].Form.Requery

The name of the subform control is NOT necessarily the same as the name of the
form object used by the subform control.

Refresh only refreshes the current record set - that is it will show changes
to the existing records. It will NOT add records to the recordset. So if you
are filtering by whether or not a field is checked, you will only refresh the
records that were checked when you built the original set. If a record that
was checked is unchecked, a refresh will show that record as unchecked but
will still show the record. REQUERY is what you need.

If all this fails, try adding a button to the subform and add code to its
click event that looks like
Me.Requery

See if that works. If it does then the next step would be to use
Forms![NameOfMainForm]![NameofSubFormC*O*N*T*R*O*L*].Form.Requery
in the correct place.

The correct place might be in the main form's activate event
Or
in the close event of the form where you are checking/unchecking jobs-to-be-at
Or
Some other place. It depends on what you are doing.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
B

babs

Forms![NameOfMainForm]![NameofSubFormC*O*N*T*R*O*L*].Form.Requery

This worked - I just had to add another subform2 to the end before requery
but it worked.

thanks sooo much,
barb

John Spencer said:
You need to requery the subform on the main form.

Forms![NameOfMainForm]![NameofSubFormC*O*N*T*R*O*L*].Form.Requery

The name of the subform control is NOT necessarily the same as the name of the
form object used by the subform control.

Refresh only refreshes the current record set - that is it will show changes
to the existing records. It will NOT add records to the recordset. So if you
are filtering by whether or not a field is checked, you will only refresh the
records that were checked when you built the original set. If a record that
was checked is unchecked, a refresh will show that record as unchecked but
will still show the record. REQUERY is what you need.

If all this fails, try adding a button to the subform and add code to its
click event that looks like
Me.Requery

See if that works. If it does then the next step would be to use
Forms![NameOfMainForm]![NameofSubFormC*O*N*T*R*O*L*].Form.Requery
in the correct place.

The correct place might be in the main form's activate event
Or
in the close event of the form where you are checking/unchecking jobs-to-be-at
Or
Some other place. It depends on what you are doing.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
I am reposting - haven't gotten answer yet??? any ideas-Thanks!

I have a subform for jobs to be at list - when I am int the actual form it
requeries and shows only the ones checked off - when I go to the mainform
with the jobs to be at list as a subform - it does not refresh or requery
unless I close and open back up again. I had added a refresh command button
with the following code:
DoCmd.RunCommand acCmdRefresh
when i press the refresh button it refreshes the job list to be at

I add this code to the Onload of the Main form - don't want user to have to
press refresh button but it doesn't refresh jobs to be at list unless press
refresh or close and open - added requery all over the place on load and on
open of all main and subforms.

what am i missing???
Barb
.
 

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