Free Access programming tutorial Video 5

In this part of the video series you’ll be able to answer the following questions:

1. What answer will be generated by the following code?
2. What will the ending value of strResponse be?
3 & 4. What value will appear in the message box generated by the following code?

Option Compare Database
Option Explicit

Sub FinishOrder()

    Dim dteOrder As Date
    
    
    dteOrder = InputBox("Enter Date")
    
    ShipOrder (dteOrder)
    
    
End Sub

Sub ShipOrder(dteShip As Date)
    
    dteShip = dteShip + 30
    
    MsgBox "Ship Date: " & dteShip

End Sub


Sub Evaluate1()
    
    Dim intX As Integer
    Dim intY As Integer
    
    intX = 8
    intY = 5
    
    intX = intX + intY
    
    If intX = 8 Then
        MsgBox intX
    Else
        MsgBox intY
    End If
    
End Sub

Sub Evaluate2()
    
    Dim intCode As Integer
    Dim strResponse As String
    Dim strTemp As String
    
    intCode = 23
    
    Select Case intCode
        Case 15
            strTemp = "Orchid"
        Case 20
            strTemp = "Morocco"
        Case 23
            strTemp = "Cheese"
        Case Else
            strTemp = "Orion"
    End Select
    
    strResponse = "Code Name: " & strTemp
    
    
End Sub

Sub Evaluate3()
    
    Dim dblX As Double
    Dim dblY As Double
    
    dblX = 1.5
    dblY = 2 * dblX
    
    If dblX > 2 Then
        MsgBox dblX
    ElseIf dblY > 3 Then
        MsgBox dblY
    Else
        MsgBox "Else"
    End If
    
End Sub


Sub Evaluate4()
        
    Dim blnOkay As Boolean
    Dim curPrice As Currency
        
    blnOkay = True
    curPrice = 5
    
    If blnOkay Then
        MsgBox blnOkay
    ElseIf curPrice = 5 Then
        MsgBox curPrice
    Else
        MsgBox "Neither"
    End If
    
End Sub

<< Free Access programming tutorial Video 4

Free Access Programming tutorial Video 6>>




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 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 […]

What Is Microsoft Access Used For?

To those of you who are asking the question of “What is microsoft access used for?” , here is my opinion. I’ve been using this program for well over 15 years, and it’s become fairly easy to deal with. Many people feel that it is hard to work with, but that’s not my experience anymore […]

How To Make An Access Select Query

Hi everyone, This is not really a VBA item, but it’s important and you will need to understand this concept when you are creating your SQL statements in VBA. In our example we have a table called “Customers”: Now we just want the customers from “London”. So we set up a select query to select […]

How To Generate A XML File With Access VBA

XML is used to structure your data. You can send a CSV file to another person, but using XML, you can structure your data in a more elegant format, and get very specific about your fields, and what data is contained within your tags (your field names). This is different than a basic CSV file […]

Previous Post

Free Access programming tutorial Video 6

Next Post

Free Access programming tutorial Video 4

Leave a Reply

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