I am watching Access Expert 12 Lesson 1. Is there a way to get rid out the Requery Command Button And just use VBA to do the same thing automatically. Maybe an After update event?
There's a button you can click to convert macros to VBA.
Richard Van WagonerOP
@Reply 2 years ago
Kevin Where would you put the me.requery code at?
Sami Shamma
@Reply 2 years ago
Richard, you put it in the event that you needed to update all the records in your continuous form or a list box. in other words, it depends on what changes have you made and where and then you trigger it from there
Sami Shamma
@Reply 2 years ago
Commonly done in an after update on a field you just changed
Richard Van WagonerOP
@Reply 2 years ago
I am following the lesson mentioned above, so I am making changes in the orderF and want the reflected in the orderlistF without having to click on the command button.
Kevin Robertson
@Reply 2 years ago
Add this code to the Close event of the OrderF:
Private Sub Form_Close()
If CurrentProject.AllForms("OrderListF").IsLoaded Then
Forms!OrderListF.Requery
End If
End Sub
This will Requery the Order List whenever the Order Form is closed.
It also makes sure OrderListF is loaded so you don't get an error if it is not open.
Richard Van WagonerOP
@Reply 2 years ago
Thanks this is just what I need!
Richard Van WagonerOP
@Reply 2 years ago
Can this code be duplicated in the same Close event only with another Form?
Such as Private Sub Form_Close()
If CurrentProject.AllForms("OutstandingInvoiceListF").IsLoaded Then
Forms!OutstandingInvoiceListF.Requery
End If
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Expert 12.