Hi everyone,
I'm trying to find the right way to do this and I'm sure it's simple. I have a form (frmDonationsSummary) that contains two text boxes (FiscalYTD and CalendarYTD). The row source for each is qryFiscalYTD and qryCalendarYTD. If I leave this form to go to another and update data, then close the form and return to frmDonationSummary (which remains open) the text boxes do not update. F5 solves the problem but I'm trying to use requery to solve this.
Should I use On Active or After Update and for that matter Refresh or Requery? Been playing with this for a while but can't get it to work.
Any help would be greatly appreciated.
Thanks! - Scott
Requery a form with text boxes as queries as data source
-
- 4StarLounger
- Posts: 402
- Joined: 14 Apr 2010, 15:59
-
- Administrator
- Posts: 78536
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Requery a form with text boxes as queries as data source
A text box has a Control Source, which must be a field in the form's Record Source or an expression (formula). It does not have a Row Source.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 402
- Joined: 14 Apr 2010, 15:59
Re: Requery a form with text boxes as queries as data source
Sorry it is a list box. I thought it was created at a text box. My mistake. Thanks Hans.
-
- Administrator
- Posts: 78536
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Requery a form with text boxes as queries as data source
Try the On Got Focus event of frmDonationSummary:
Code: Select all
Private Sub Form_GotFocus()
Me.FiscalYTD.Requery
Me.CalendarYTD.Requery
End Sub
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 402
- Joined: 14 Apr 2010, 15:59
Re: Requery a form with text boxes as queries as data source
Thank for the quick response. That didn't work.
-
- Administrator
- Posts: 78536
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Requery a form with text boxes as queries as data source
Does it work if you use the On Activate event of frmDonationSummary instead of the On Got Focus event?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 402
- Joined: 14 Apr 2010, 15:59
Re: Requery a form with text boxes as queries as data source
That did it. Thank you very much Hans. Have a great week.