Time for a quick Access quiz. These five questions cover a handful of small but important details involving form properties, macros, control events, fonts, and section references. They are exactly the kinds of things that can trip you up when everything looks fine in the Property Sheet, but your macro suddenly decides to throw a tantrum.
Give yourself a few seconds for each question before reading the answer. No cheating. Well, very little cheating. If you get all five, congratulations: your Access skills are operating at peak desktop nirvana.
Question 1: When a macro changes a control's Height or Width property, what unit does Access use?
A. Screen pixels
B. Twips
C. Inches
D. Points
Answer: B. Twips. Access uses twips for measurements such as a control's Height, Width, Top, and Left properties. There are 1,440 twips in one inch. The Property Sheet may display measurements in inches depending on your settings, but the actual property value used in expressions and macros is typically in twips. If you are not sure what number to use, check the current property value and work from there.
Question 2: You want a notes text box to expand while the user is editing it and return to normal afterward. Which event setup is most appropriate?
A. Expand it in On Click and shrink it in On Double Click
B. Expand it in On Load and shrink it in On Close
C. Expand it in On Got Focus and shrink it in On Lost Focus
D. Expand it in Before Update and shrink it in After Update
Answer: C. Expand it in On Got Focus and shrink it in On Lost Focus. Got Focus fires when the user enters the control, whether they click in it or tab into it. Lost Focus fires when they move away. That makes these events perfect for a temporary zoom effect on a notes box or any other field where the user may need a little extra room to work.
Using Click is a common beginner mistake because it seems like it should work. But Click only catches mouse activity. A user who tabs into the control would miss it entirely. Got Focus handles both situations without making you build separate logic for each.
Question 3: Why is it usually best to use a common Windows or Office font when setting a control's Font Name in an Access application?
A. A missing custom font can produce unreliable or substituted results on another computer
B. Access can assign Font Name only to labels, not text boxes
C. Custom fonts can be used only in reports
D. Font names must always be numeric values
Answer: A. Access can request just about any installed font, but that font has to exist on the computer running your database. If it does not, Windows may substitute another font, and suddenly your carefully aligned form looks like it was assembled during a power outage.
For databases that will be shared with other users, stick with common fonts such as Calibri, Arial, Tahoma, or Times New Roman. Tahoma remains one of my personal favorites. It is clean, readable, and unlikely to disappear when your database gets copied to someone else's machine.
Question 4: A macro uses SetValue to change a text box's BackStyle. Why can assigning the text "Normal" cause an error?
A. BackStyle can be changed only in VBA
B. SetValue can modify only bound fields
C. BackStyle must be assigned a color expression such as RGB()
D. BackStyle uses a numeric property value rather than the displayed word
Answer: D. The Property Sheet often displays friendly labels, but not every property is actually stored as text. BackStyle is numeric: Normal is 1 and Transparent is 0. A macro using SetValue needs the underlying numeric value, not the word shown in the drop-down list.
This is one of those Access details worth remembering. The Property Sheet is designed for humans. Macro expressions have to work with the actual value Access expects. If a property setting looks like a word but refuses to cooperate in SetValue, check whether it is really an enumeration or numeric setting hiding behind a friendly label.
Question 5: In a macro, which reference targets the BackColor of the Detail section on an open form named CustomerF?
A. Forms!CustomerF.BackColor
B. Forms!CustomerF!Detail.BackColor
C. CustomerF!BackColor
D. Forms!Detail!CustomerF.BackColor
Answer: B. Forms!CustomerF!Detail.BackColor. You start with the Forms collection, identify the open form, then identify the Detail section, and finally specify the property you want to change. The visible background area of most forms is the Detail section, so that is usually the BackColor property you are looking for.
There are often multiple valid ways to refer to objects in Access, especially when you are working inside a form module or form-level macro. But when you need a fully qualified reference to an open form's Detail section, Forms!CustomerF!Detail.BackColor is the clear and reliable choice.
So, how did you do? If you missed a couple, do not worry. These are not huge concepts individually, but they are the little nuts and bolts that make Access forms and macros behave properly instead of acting like a Windows 95 machine trying to dial into the Internet.
These topics and plenty more are covered in Access Advanced Level 3, Lesson 2. Watch the embedded video for the quiz and explanations, then check out the course if you want to dig deeper into form properties, macros, events, and making your Access applications a lot more polished.
Live long and prosper,
RR
No comments:
Post a Comment