Form Refresh

mavver

Registered User.
Local time
Today, 16:18
Joined
Jan 12, 2007
Messages
28
Hello All

these last two weeks I have gone on a self taught VBA coding journey, and suprisingly it has gone quite well.

However, just to finish off what I am working on I have one small issue that I am sure someone can help me with

I have some code, which works fine but when it has all finished I need to press F9 to refresh the form to bring through the new or revised results.

Is there a line I can place within the code somewhere that will press F9 and refresh the form for me so I can do away with this last bit of manual usage.

Thanks

Mav
 
Depending on what you are doing, you can use put this code in the form's AfterUpdate event:

If you are just editing data and not adding any new records
Code:
Me.Refresh

or, if you are adding new records
Code:
Me.Requery
 
Here's a quote from the MS Access VBA Help file:
The Refresh method shows only changes made to records in the current set. Since the Refresh method doesn't actually requery the database, the current set won't include records that have been added or exclude records that have been deleted since the database was last requeried. Nor will it exclude records that no longer satisfy the criteria of the query or filter. To requery the database, use the Requery method. When the record source for a form is requeried, the current set of records will accurately reflect all data in the record source.
 

Users who are viewing this thread

Back
Top Bottom