MS ACCESS FORM OBJECTS – PT2

Get all the videos in this Access VBA collection 100% FREE by signing up at https://vbahowto.com/ms-access-tutorial

In this video I continue to talk about ms access form object items as I demonstrate how to set control values. I also will show how to reference ms access form object items.

This is part 2 of a 3 part video series.

Here I am assigning the “Caption” property of the form based on what is in the “CategoryName” field:

Forms!Categories.Caption = Me.CategoryName

Option Compare Database

Private Sub Form_Current()
    Dim intResult As Integer
    
    Forms!Categories.Caption = Me.CategoryName
    
    intResult = calculate(6, 6)
    
    MsgBox intResult
    
    
End Sub

Function calculate(num1, num2)
    Dim dblResult As Double
    
    dblResult = num1 + num2
    
    calculate = dblResult
    
End Function

Click here for the database and the code:
Nwind_2k_modified.mdb

<< MS ACCESS FORM OBJECTS – PT1 | MS Access Form Objects – PT3 >>




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 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 handle errors in Access VBA code?

I am going to give you the answer to “How do I handle errors in Access VBA code?” In my opinion there are 2 ways to handle errors: 1. Avoid the potential for an error to occur. 2. Handle the error in your code. Number 1 – If you have a control on your form […]

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 OBJECTS – PT3

Next Post

MS ACCESS FORM OBJECTS – PT1

Leave a Reply

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