Microsoft Access
Looping exercise
Harder than average exercise

This Microsoft Access LOOPING exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl ACCESS VISUAL BASIC course only, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

Exercise: Validation using collections

A full answer to this exercise is provided as part of the training course!

1) Download the files needed to start this exercise: exercise-258.zip (and click here if you experience any problems unzipping this file after downloading it).
2) Open the form called TeamPlayers (looping).
3) A typical piece of validation for this form would prevent the user leaving the team or player field blank:
Exercise screen-shot 416 A typical validation routine for a single control
4) Enter an appropriate error message in the Tag property for each control whose value may not be blank.
Exercise screen-shot 417 The tag property can be used for our convenience!
5) Write a routine which, when you try to save a record:
  • Loops over all the controls on the form, checking to see if the length of their tag property is 0 (use the LEN function);
  • For each control whose tag property is set, checks to see if the control is null; and
  • If it is, displays an error message, goes to the control, cancels the record update and exits the validation routine without further processing.
6) Save this form as TeamPlayers (validation) and close it down.

Thank you for showing an interest in this Access Visual Basic training course! As mentioned above, full answers to this and other exercises are provided on the course. On all Wise Owl scheduled courses delegates can take away these model answers (together with their own efforts!) on a free USB stick.

All content � Wise Owl Business Solutions Ltd 2007.  All rights reserved.  Design by Branches.