Refresh query
-
- BronzeLounger
- Posts: 1389
- Joined: 08 Jul 2016, 18:53
Refresh query
What would be the syntax for refreshing a query that is not in focus?
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Refresh query
That's not possible as far as I know. You'd have to close it and reopen it, but that would defeat the purpose, I guess.
(You don't want to hear this, but you should only use forms and reports to present data)
(You don't want to hear this, but you should only use forms and reports to present data)
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1389
- Joined: 08 Jul 2016, 18:53
Re: Refresh query
Well then what would be the syntax to refresh a form not in focus?
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Refresh query
If you want to update the records that are already displayed in the form, that would be
Forms![NameOfTheForm].Refresh
If records might have been added or deleted, use
Forms![NameOfTheForm].Requery
to show those changes too.
Forms![NameOfTheForm].Refresh
If records might have been added or deleted, use
Forms![NameOfTheForm].Requery
to show those changes too.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1389
- Joined: 08 Jul 2016, 18:53
Re: Refresh query
Well since I can't refresh queries with code, which seems odd, I'll make some forms out of the queries and d it that way. One small nuisance, though I will have to change the criteria on the query to make form display what is needed. With just the query, I change the date and then hit the little refresh all button. I was attempting to refresh after a profit was recorded. So I guess it is six of one and a half dozen of the other.
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Refresh query
You could use a text box on the form in which you enter the date.
Either use the After Update event of that text box, or the On Click event of a command button on the form to filter the form based on the date.
Either use the After Update event of that text box, or the On Click event of a command button on the form to filter the form based on the date.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1389
- Joined: 08 Jul 2016, 18:53
Re: Refresh query
Here is the form in design view, where would I put a text box so it shows in DS view, like the second image??
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Refresh query
This won't work in Datasheet View. You'd have to create a main form in Form View with a subform in DataSheet View.
Alternatively, use a continuous form that you design to look like a datasheet form.
Alternatively, use a continuous form that you design to look like a datasheet form.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1389
- Joined: 08 Jul 2016, 18:53
Re: Refresh query
I don't know how to do any of that so, the idea is scrapped and I will trfresh the query manually, thanks.