Friday, May 11, 2012

Selection using ALL, Division, Region, Branch

I've tried several methods of allowing users to make selections of ALL, Region and Branch and came up with a  way of doing it but only if the Branches assigned to a Region do no overlap.  This has it's obvious limitations and will definitely not work for Customer with a large number of Branches.  I was discussing this in one of the Excel classes I was conducting at our User Group meeting in Las Vegas and was asked why I didn't just utilize the available fields in the Branch Item Master file to make this selection.  I had thought of this solution previously but could not determine how it could be used.  This was because I was limiting myself to using a range of values in my SQL statement.  Once I began to consider other ways of accomplishing the goal it seems that the solution came very quickly.  Rather than using a range of values it was only necessary to use the OR statement.  The statement works like this..... Company = value OR Division = value OR Region = value OR Branch = value.  When the parameters values are passed to the MS Query  only one is valid, the others are invalid.  Such a simple solution and so easy to implement.

No comments:

Post a Comment