Access Video Quiz D2.2By Richard RostWhere Can a Private VBA Procedure Be Called From? What does declaring a procedure as Private Sub mean in a form's VBA module? Welcome to another Microsoft Access Video Quiz. You will be asked five Developer-level questions covering VBA procedures, parameters, Select Case statements, If...ElseIf control flow, and divide-by-zero testing. Answer each question, check your score, and see how well you know Access VBA. Recommended CoursesWant More?Keywords |
||||||||||||
| Age | Subject | From | |
| 8 hours | Post Your Quiz Score Here! | Richard Rost | |
More Information
Transcript
This one's for developer-level users.
I'm going to give you five questions on VBA. You'll have three seconds to answer each one, so use that pause button if you need more time. Keep track of your score so you can see how you did at the end.
Are you ready to choose the right path? Here we go.
Question 1.
What does declaring a procedure as Private Sub mean in a form's VBA module?
Any form or module in the database can call it?
Only code in that form's module can call it.
It can only run from a command button's Click event, or it can only be called from a query.
That's going to be B. Only code in that form's module can call it.
Question 2.
Given Private Sub Calculate and then Operation As String as a parameter, what does the call Calculate Add do?
It passes the text Add into the Operation parameter and runs the procedure.
It declares Operation as a new string variable.
It assigns the procedure's return value to Operation, or it passes both Add and Subtract to the procedure.
It passes the text Add into the Operation parameter and runs the procedure.
Question 3.
Why is Select Case often a good choice when one variable can contain several operation names?
It automatically converts every operation name into a number.
It runs every Case block so all operations are checked.
It organizes several alternatives around one expression and runs the matching Case.
It can be used only when the variable is a numeric data type.
You may have to think about this one for a second.
That's going to be C. It organizes several alternatives around one expression and runs the matching Case.
Question 4.
What is the main control flow advantage of an If, ElseIf chain over several separate If blocks when only one operation should run?
ElseIf repeats the first condition until it becomes false.
ElseIf causes all conditions to run at the same time.
ElseIf automatically returns a value from the procedure.
After a true condition is found, later ElseIf conditions are skipped.
That's going to be D. After a true condition is found, later ElseIf conditions are skipped.
And you've got to be careful because if you have multiple operations on the same line, like if this or this or that, those will all be evaluated. That does not short-circuit, so be careful there.
Question 5.
Inside a Select Case Operation block, where should a divide-by-zero test be placed if it applies to only division?
Before Select Case, so every operation must pass the division test.
Inside Case Divide, before performing the division.
Inside Case Else, after all known operations fail.
After End Select, after the division has already occurred.
And this will be B, inside Case Divide before performing the division.
Alright, how'd you do?
Did you get all five right?
Did you ride into final battle with a trumpet and a plan?
Or did you lose an argument with a talking tree?
Well, if you missed any of these questions, this and a lot more is covered in my Access Developer Level 2 class, Lesson 2, where we continue building the calculator app.
Thanks for playing. Be sure to post your score in the comments down below, and may your code avoid the long road to Mordor.
And until next time, live long and prosper.Intro
|
| |||
| Keywords: Access Video Quiz, VBA Select Case, VBA Private Sub scope, VBA procedure parameters, VBA If ElseIf chain, VBA divide by zero, VBA Select Case Case Else, VBA boolean evaluation, VBA calculator app, VBA quiz PermaLink Where Can a Private VBA Procedure Be Called From Within Microsoft Access? Video Quiz D2.2 |