VBA Form Object Event Procedures

In this video I talk about how to program vba object items like
the access form .

Specifically we look at the Access Form Open Event, and add a password prompt in the open event of the form.

Also we will look at controlling the Cancel Open Event of the form.

Private Sub Form_Open(Cancel As Integer)
'    MsgBox "form opened"
    
    Dim strPassword As String
    
    strPassword = InputBox("Enter The Password")
    
    If strPassword <> "Password" Then
        MsgBox "Incorrect Password"
        Cancel = True
    End If
    
    
End Sub

<< VBA Event Driven Programming | MS Access Form 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...

Find Error Line Number in VBA With Erl

In this post you are going to find out a way of handling errors in your code with the Erl function. Erl displays the last label before the error Another alternative error handling solution is using labels at each point in long procedure. Here we get a random error: Here is the code behind the […]

Here Is A Customized Msgbox VBA Example

Here is an example of a customized VBA Msgbox. We giving some richtext and customizable flair to the rather ordinary message box. The following code provided with the code after the screenshot, is going to provide you with the ability to really make the ordinary message box shine! Sub MsgboxVBAExamples() Dialog.Box “VBAHowTo.com is your source […]

How To Use The VBA Input Box Cancel Button To Exit Sub

This post will demonstrate how you can use the VBA input box cancel button to exit the sub procedure. When you click the “Cancel” button on the input box, you return a null (blank) value, and knowing this information, you can exit the sub procedure. Here is an example:   Sub VBAInputBoxCancel() Dim strResponse As […]

VBA Debug Part 2

In this video I talk about VBA Debug aspects like the Immediate Window, Local Window and Watch Window. …also we use the “debug.print” statement to print a value to the Immediate window. The Local Window is useful to view the current state of all the variables present in the current sub procedure. The Watch Window […]

Previous Post

MS ACCESS FORM VALIDATION – PT1

Next Post

VBA Event Driven Programming

Leave a Reply

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