Software

Use control properties to turn on form messages in Access

With Access' SetValue control property, you can display a message when the value of a field reaches a certain level. Follow these steps to turn on form messages.

With Access' SetValue control property, you can display a message when the value of a field reaches a certain level. For example, you have a form named Customer that you use to update the Customer table's Balance field. When the customer's outstanding balance is over $0, you want to display the message Send Bill Today!

Follow these steps to turn on form messages:

  1. Open the Customer form in Design view.
  2. Click the Label tool in the Control Toolbox.
  3. Click and drag in your form next to the Balance Field control to create the Label control that will hold your message.
  4. Right-click the Label control and select Properties.
  5. Under the Format tab, click in the Caption property box and enter Send Bill Today!
  6. Under the All tab, click the Name property and enter lblSendBill.
  7. Right-click the Balance Field control.
  8. Select Properties.
  9. Under the Event tab, click in the After Update property box and then click the Build button.
  10. Select Macro Builder and then click OK.
  11. Enter SetValueAfterUpdate in the Macro Name box and click OK.
  12. Click the Conditions button in the Macro toolbar.
  13. Click the first cell under Condition and enter [Balance]=0.
  14. Press [Tab] and click the drop-down arrow and select SetValue.
  15. Under Action Arguments, click in the Item box and then click the Build button.
  16. Click the All Forms folder in the left panel and then click Customer.
  17. Click lblSendBill in the middle panel.
  18. Click Visible in the right panel.
  19. Click the Paste button and then click OK.
  20. Click in the Expression box under Action Arguments and enter No.
  21. Click the second cell under Condition and enter [Balance]>0.
  22. Press [Tab], click the drop-down arrow, and select SetValue.
  23. Under Action Arguments, click in the Item box and then click the Build button.
  24. Click the All Forms folder in the left panel and then click Customer.
  25. Click lblSendBill in the middle panel.
  26. Click Visible in the right panel.
  27. Click the Paste button and then click OK.
  28. Click in the Expression box under Action Arguments and enter Yes.
  29. Close and save the macro.
  30. Click the drop-down list of the Properties box and select Form.
  31. Under the Event tab, click in the On Current property box and click the Build button.
  32. Select Macro Builder and then click OK.
  33. Enter SetValueOnCurrent in the Macro Name box and click OK.
  34. Click the first cell under Action, click the drop-down arrow, and select SetValue.
  35. Under Action Arguments, click in the Item box, and then click the Build button.
  36. Click the All Forms folder in the left panel and then click Customer.
  37. Click lblSendBill in the middle panel.
  38. Click Visible in the right panel.
  39. Click the Paste button and then click OK.
  40. Click in the Expression box under Action Arguments and enter No.
  41. Close and save the macro.

When you open your form, the label will not be visible. It will only be visible when the user enters an outstanding balance.

Miss an Access tip?

Check out the Microsoft Access archive, and catch up on other Access tips.

Help users increase productivity by automatically signing up for TechRepublic's free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.

Editor's Picks

Free Newsletters, In your Inbox