MS Access Form Events – PT2

This video covers the following MS Access Form Events:

Form_Delete
Form_Unload
Form_Close

Remember:
The Unload Event happens before the Close Event.

Private Sub Form_Close()
    'happens after the unload event
End Sub


Private Sub Form_Delete(Cancel As Integer)
    If MsgBox("Continue with Delete?", vbYesNo) = vbNo Then
        Cancel = True
    End If
End Sub
  
Private Sub Form_Unload(Cancel As Integer)
    If MsgBox("Close Form?", vbYesNo) = vbNo Then
        Cancel = True
    End If
End Sub

<< MS Access Form Events – PT1 | MS Access VBA Control Events – PT1 >>




By the way, if you got or are getting value from the VBA information, please give me a tip, thanks!


These posts may help answer your question too...

How To Make An Access Form Time Picker

Here is a relatively easy way to select times for your time entry text boxes. It’s a reusable form that allows you to pick a time from an Access form. There are probably different ways to do this but here is the way I would do it. On the form that has the time fields, […]

How to pick a file to load In VBA

Picking a file to load in your Microsoft App is a very important skill to know. In this blog post you will see how to do it. First you need to set a reference to the MS office object library From VBE editor –> select Tools > MS office object library (click check mark) Sub […]

What is the purpose of the Me keyword in Access VBA?

What does the Me keyword mean? “Me” refers to the Access form currently in focus. Instead of writing out the entire form reference, you can just use the keyword “Me” which is easier. Like: Me.txtbox = “I am a textbox on the form that currently has the focus.” or you can update a label’s caption […]

How do I run VBA code when form opens

How do I run VBA code when form opens? There are probably several ways people do it, and some may say “He’s not doing it right. It’s done this way…” Good for you. This is the way I do it now, and it has worked well for me. 1. Find the form you want to […]

Previous Post

MS Access Form Events – PT1

Next Post

How To Do A VBA CSV Import For One To Multiple Files

Leave a Reply

Your email address will not be published. Required fields are marked *