Access Video Quiz D3.1
By Richard Rost
8 hours ago
DLookup Null Assignment to Long Variable Why should you explicitly declare a variable with DIM in VBA? Welcome to another Microsoft Access Video Quiz. You will be asked five Developer-level questions about VBA variables, default values, checking for duplicate records, handling Null values returned by DLookup, and responding to message box choices. Answer each question, check your score, and see how well you know Access VBA. Recommended CoursesWant More?KeywordsAccess Video Quiz, VBA variables, DIM statement, VBA data types, Long variable default value, DLookup Null error, Nz function, duplicate record check, MsgBox Yes No Cancel, vbYes condition
More InformationTranscript Welcome to another video quiz from Access Learning Zone.
This one's developer level, with 5 questions about working with variables in VBA.
You'll have 3 seconds for each question. Feel free to hit the pause button if you need more time. Keep track of your score. Let's head on to the grid and see how your code holds up.
Question 1.
Why should you explicitly declare a variable with DIM in VBA?
It permanently saves the value in a table, it establishes a variable and allows you to specify its data type, it automatically creates a matching form control, it makes the variable available to every procedure.
That is B. It establishes a variable and allows you to specify its data type.
Question 2.
A variable is declared as Long and hasn't been assigned a value. What does it contain?
Null, empty string, zero, or the last value stored in memory.
That's going to be zero, but don't rely on it. Always initialize your variables.
Question 3.
You're checking for a duplicate sale using employee, date, and amount.
What makes the check reliable?
Match the employee ID only, match the date and amount only, match any one of the three fields, match all three fields in the same record.
You're going to match all three fields in the same record.
Question 4.
DLookup returns Null when no matching record exists.
What happens if you assign that Null directly to a Long variable without handling the error?
VBA raises an invalid use of Null error, the variable becomes negative 1, VBA converts Null into zero, the matching record is deleted.
That's going to be VBA raises an invalid use of Null error. Make sure you wrap it in Nz.
And question 5.
In VBA, you display a message box with Yes, No, and Cancel buttons.
You want your code to continue only if the user clicks Yes. Which condition should you use?
There's four conditions to pick from. You pick it and let me know.
It's going to be option B, my reply equals VBA.
All right, how'd you do?
Did you get 5 out of 5?
Are you the programmer who mastered the grid and saved the program?
Or the one who brought the joystick to the code review?
Well, if you missed any of these topics, more are covered in Microsoft Access Developer Level 3. We work with variables, check for possible duplicate records, and respond to choices your users make.
You'll find links below.
Thanks for playing. Post your score in the comments down below, and don't leave your variables behind on the grid.
Until next time, live long and prosper. Intro Why should you explicitly declare a variable with DIM in VBA? Welcome to another Microsoft Access Video Quiz. You will be asked five Developer-level questions about VBA variables, default values, checking for duplicate records, handling Null values returned by DLookup, and responding to message box choices. Answer each question, check your score, and see how well you know Access VBA.
|