Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refresh data in subform

Status
Not open for further replies.

kronar

Programmer
Jan 12, 2003
60
US
I am trying to update data in a subform by modifying the query it is based upon. The query updates however the subform data displayed won't refresh until next time I open the form?

main form = [frmEnter Times]
subform control = TimebyDate
source = EmpTimebyDate a form
EmpTimebyDate record source = UpdateTimeQuerybyDate

I've tried:
RefreshDatabaseWindow
EmpTimebyDate.Requery

Forms!TimebyDate.Requery
Forms![frmEnter Time].Requery
most give compile error.
 
How are ya kronar . . .

Referencing the subform depends on which code module the code is running in. If its running in the mainform try:
Code:
[blue]   If Me.Dirty Then Me.Dirty = False [green]'Save the current record[/green]
   [TimebyDate].[purple][b]Form[/b][/purple].Requery[/blue]
... else if its running in the subform try:
Code:
[blue]   If Me.Dirty Then Me.Dirty = False [green]'Save the current record[/green]
   Me.Requery[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks - worked great. I was accessing the subform from the form's update rec button.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top