subform requery

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

Guest

I realize this question has been answered a million times, but for some
reason I can't seem to make it work.

I have a button on a tab control. When a user presses the button, it is
supposed to generate a checklist (using an append query to populate the table
with the entries) and display that checklist in a subform below the button on
the tab control. I have tried every type of requery/refresh/recalc/repaint
in the book and the subform will not display the appended records until I
move off the record and then go back to it - or if I press the F9 key.

What in the world am I doing wrong????????

Any help would be greatly appreciated.

Thanks,

Janelle
 
Hi Janelle

I found that just using the subform.requery line didn't work for me either.
So what I ended up doing, and I don't know if it's the best way, but it works
for me, is to use the following code in the on click event of the button.

Private Sub [BUTTON]_Click()
Me.[SUBFORM NAME].SetFocus
Me.[SUBFORM NAME].Requery
End Sub

You can also insert a line at the end to SETFOCUS on whatever control the
user needs to go to after they've clicked the button and retrieved the
relevant records.

Hope this helps.

Regards
Winsa
 
Winsa,

Thank you for your assistance! That took care of it!

winsa said:
Hi Janelle

I found that just using the subform.requery line didn't work for me either.
So what I ended up doing, and I don't know if it's the best way, but it works
for me, is to use the following code in the on click event of the button.

Private Sub [BUTTON]_Click()
Me.[SUBFORM NAME].SetFocus
Me.[SUBFORM NAME].Requery
End Sub

You can also insert a line at the end to SETFOCUS on whatever control the
user needs to go to after they've clicked the button and retrieved the
relevant records.

Hope this helps.

Regards
Winsa

JRB said:
I realize this question has been answered a million times, but for some
reason I can't seem to make it work.

I have a button on a tab control. When a user presses the button, it is
supposed to generate a checklist (using an append query to populate the table
with the entries) and display that checklist in a subform below the button on
the tab control. I have tried every type of requery/refresh/recalc/repaint
in the book and the subform will not display the appended records until I
move off the record and then go back to it - or if I press the F9 key.

What in the world am I doing wrong????????

Any help would be greatly appreciated.

Thanks,

Janelle
 
Back
Top