Requery in Place: How to Requery a Continuous Form in Microsoft Access Without the Focus Moving
HTML-код
- Опубликовано: 1 авг 2024
- In this Microsoft Access tutorial, I'm going to teach you how to requery a continuous form in place so that the data updates but the focus doesn't move. We will use an On Got Focus event with a Me.Recordset.Requery, and I'll also show you how to make a custom edit form with a Close event to do the same thing, but is better for large datasets.
Damaris from Milwaukee, Wisconsin (a Platinum Member) asks: I have a continuous form much like your customer list form, however because I have some aggregate functions in there, it's not updateable. I can made it so I can double click to open up a single form where I can edit records individually but then when I return back to the continuous form the data doesn't update. And if I issue a requery command, it puts me back up at the top of the list. Is there any way to refresh that form and update the data without the focus moving?
Silver Members and up get access to an Extended Cut of this video. Members will learn how to edit data in a non-updateable continuous form in place using one of my secret special tricks. Curious as to what the trick is? Join today!
MEMBERS VIDEO:
• Requery in Place MEMBE...
BECOME A MEMBER:
RUclips: / @599cd
or My Site: 599cd.com/THMember
LEARN MORE:
599cd.com/RequeryInPlace
PRE-REQUISITES:
Intro to VBA: 599cd.com/IntroVBA
Aggregate Query: 599cd.com/Aggregate
Not Updateable: 599cd.com/NotUpdateable
LINKS:
Invoicing: 599cd.com/Invoicing
On Got Focus: 599cd.com/OnGotFocus
Modal & Popup: 599cd.com/ModalPopup
Simple Security: 599cd.com/SimpleSecurity
Open Form: 599cd.com/OpenForm
Mike's Article: nolongerset.com/requery-a-for...
Double Double Quotes: 599cd.com/DoubleDouble
THE CODE:
Me.Recordset.Requery
RECOMMENDED COURSES:
Access Developer 1: 599cd.com/ACD1
FREE TEMPLATE DOWNLOADS:
TechHelp Free Templates: 599cd.com/THFree
Blank Template: 599cd.com/Blank
Contact Management: 599cd.com/Contacts
Order Entry & Invoicing: 599cd.com/Invoicing
More Access Templates: 599cd.com/AccessTemplates
ADDITIONAL RESOURCES:
FREE Access Beginner Level 1: 599cd.com/Free1
$1 Access Level 2: 599cd.com/1Dollar
Donate to my Tip Jar: 599cd.com/TipJar
Get on my Mailing List: 599cd.com/YTML
Contact Me: 599cd.com/Contact
TechHelp: 599cd.com/TechHelp
Consulting Help: 599cd.com/DevNet
Twitter: / learningaccess
en.wikipedia.org/wiki/Microso...
products.office.com/en-us/access
microsoft.com/en-us/microsoft...
KEYWORDS:
access 2016, access 2019, access 2021, access 365, microsoft access, ms access, ms access tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, Retain position on continuous form through requery, Refresh or requery, Form.Refresh, Form.Requery, refreshing or requerying a continuous form, Restoring a continuous form after Requery, Requery a Form in Place, Form.Recordset.Requery, requery a single record in a continuous form microsoft access, edit non-updateable form in place
QUESTIONS:
Please feel free to post your questions or comments below. Thanks.
Richard i learn a lot with your videos, thank you men, i am a super fan
Another excellent video Richard I have learnt so much from just tech help videos alone
Glad to hear it
Nothing is sweeter than one line of code to replace multiple lines.
My way of doing this was to save the bookmark, requery the form and then restore the bookmark.
This is way better and less code.
Better to just create a function all together and reuse.
Function requery_in_place(form_name as string)
Forms!form_name.recordset.requery
End Function
And then invoke/call the function in the form as:
requery_in_place(me.name) or outside the form as:
requery_in_place(form_name)
Thanks so much for sharing ❤.
Yeah, i've never been a fan of bookmarks
I had totally forgotten how to do this! THANK YOU for this video!
You're welcome welcome
Excellent tip. This works on datasheets too. If there are tons of records, I may want to requery only if the user actually changed data in the record to improve performance. And that's a bit tricky to do.
Yep!
Excellent Video!!! Also glad to see you are a fan of both TNG and Rush.
Absolutely... my first concert (ever) was Roll the Bones
Very useful layout
thanks
Thank you sir
Welcome
Thanks, Excellent Tip!
If you use a Dialog Form, you can also requery the Form after the OpenForm method call.
Private Sub OpenCustomer()
If IsNull(CustomerID) Then Exit Sub
DoCmd.OpenForm "CustomerEditF", , , "CustomerID=" & CustomerID , , acDialog
Me.Recordset.Requery
End Sub
(Only works with a Dialog Form)
Awesome 👌
Thanks
Thanks Rick for the useful tips.
My way of re-querying CustomerListF form involves the following simple VBA code. Which can be added to the On Close event in the CustomerF form:
If CurrentProject.AllForms("CustomerListF").IsLoaded Then
Forms!CustomerListF.Recordset.Requery
End If
This way if the CustomerListF is active in the background, it will get requeried. If not, the requery command will not fire.
Thank you again for the video
This is cool. You place the code in the close event of the pop-up form. Thanks for sharing.
Yep. I've covered IsLoaded in a few of my Developer videos, and I made a function out of it for my Code Vault. I plan on covering this in a future TechHelp video too.
Very nice and thank you. This unfortunately does not work if your backend is passthrough query based on SQL server sotred procedure.
Sounds about right
This is great! Never knew it could be so easy. However, it's not working on my forms that are running a passthrough query to SQL server. Is there a way to make it work in this scenario?
599cd.com/ask
Pls i need help my form details are not displaying when viewing after queries in ms access I need help.thanks
Does it only work for continuous form? I am trying to requey single form but it doesn’t work. Form is opened on double click event to add options and code is close button of pop form
It should
Great Rost. But instead of a custom form , I just set a flag in the customer detail form.
Cool beans whatever works for you
I am a Gold Member of your Computer Learning Zone and I need to ask you a question about a problem I am trying to figure out in Access. What is your email address?