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>>


Leave a Reply