Part III: More-Advanced Access Techniques
726
Only when the information contained in the control is needed do you reset the Visible property
to True.
An example might be a message to the Northwind Traders customers that a certain item has been
discontinued and inventory is shrinking. It’s silly to show this message for every item in the
Northwind catalog; including the number of units in stock, in conjunction with a message that a
particular item has been discounted, might encourage buyers to stock up on the item.
Figure 20.21 shows rptPriceList in Print Preview mode. (You may have to right-click on the
report name and select Print Preview from the context menu.) Notice that the Guarana Fantastica
beverage product appears in italics, the price is bold italics, and the Only 20 units in stock!
message appears to the right of the product information.
FIGURE 20.21
Can you tell Guarana Fantastica is on sale?
Figure 20.22 reveals part of the secret behind this technique. The visible unit price text box is
actually unbound. This is the text box used to display the unit price to the user. Another text box
is bound to the UnitPrice field in the underlying recordset, but it’s hidden by setting its
Visible property to No. Just to the left of the hidden UnitPrice field is a hidden check box
representing the Discontinued field. txtMessage, which contains the Only x units in
stock! message is also hidden.