A few weeks back, I created a post called 9 Interview questions to ask Microsoft Access Developers, and I challenged my loyal readers to try and answer them. Below are the questions and answers.
1. What is a collection?
Answer: A group of objects held together by a class or custom grouping, (as Anders noted, you can create your own collection of objects). You may not realize it, but every time you use the syntax Forms!MyForm to either make a form invisible or do other actions, you are using the Form collection in Access. Another useful collection is the Controls collection of the Form class.
2. What property does every object in MS Access have?
Answer: The name property. I use this property to determine if my reference is correct, as I frequently tell my students, “If you can name it, than you have the right object”. For example, if there is a button called “cmdOpen” on the “frmMainMenu” form, I can reference it with Forms!frmMainMenu.cmOpen.Name. It should show up as cmdOpen on the immediate window.
3. What is the name of the collection housed inside a form?
Answer: The Controls collection. I most often use this collection when I wish to make certain objects invisible/visible based on the user’s role in the system. In order to do so, I’ll use the tag property as discussed in Question 4 below.
4. What is the tag property and how can it be used?
Answer: For whatever you wish, it’s a property you can assign any string value. I love using it to identify controls only a certain role can see on the form, so I’ll assign Admin to the tag or purchasing or 1, whatever I wish.
5. The form collection represents all forms in a database. (True or False)
Answer: False, it only represents open forms in the database. If you have 20 forms in your database and only 3 are open, the expression Forms.Count will return only 3.
6. The tabledefs collection represents only open tables. (True or False)
Answer: False, unlike the Forms collection, the table collection represents all tables, regardless of whether they are open or not. (The reverse of the form collection).
7. What property of the querydef object can you use to change the SQL syntax?
Answer: SQL property. If you declare a qdf variable and assign it to a query, you can change the syntax of the sql statement using qdf.sql = “Select…”. One interesting feature of this property: You don’t have to save the changes, they are immediately saved. Compare that with the DAO recordset object where you must use the Edit method followed by Update in order to save your changes.
8. What would you use the recordsetclone object of the form for?
Answer: to find records, perform math calculations, (the total for a certain dollar figure based on a complex criteria for example), etc. In other words, it represents all the data your form has access to in your code.
9. Mention at least one use of the bookmark property of the form?
Answer: To search for records. This is a trick question since I only know of one use of this property.
Congrats to Tony, Giorgio and Anders for answering all questions correctly, special mention to Bill who only missed question 5. I assigned a number between 1 and 3 based on how quick you submitted your answers, so Tony was 1, Giorgio 2 and Anders 3. The random number generator t Random.org picked: 3 Anders!
Congrats Anders, your $25 Amazon gift card is on it’s way! Hope you can buy something with it while you are at PAUG and take it back with you to Denmark.
Thanks to all for participating!