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

Learn Access VBA: Understand Tables, Queries, Forms, and Reports
Learn Access VBA: From Zero to Database Hero If you’ve ever opened Microsoft Access and wondered how all the pieces fit together — tables, queries, forms, and reports — this tutorial is made for you. In just a few minutes, you’ll understand how Access works behind the scenes and see how VBA (Visual Basic for […]
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 […]
Support these sponsors:
