Machiaveli
Programmer
Hello,
Could somebody provide me an example code about using an arry in combination with a select case statement.
What i would like to achieve is that when i'm using a lookup table, the array should be filled with those values. Then in the select statement, the array would be the case.
This way i don't have to hardcode any data-values in vba.
The purpose of al this is having cleaner code.
For example:
I have a form where i insert physicaldata like length, weight, etc. and examinationsubject.
When i use a combobox for looking up the examintionsubject, the validationrule for weight must be set.
The criteria for this are examinationsubject, gender and the range where the weightvalue is valid (between 5500 and 9000).
the should be like
array(1 month, 2 month, etc.) 'filled by the a lookup table
select case array(1 month) and array(male)
case some value in the array
weight.validationrule = between (some value in the lookuptable) and (some value in the lookup table)
length.enabled = false (depending of the case)
I hope i was clear about my explaination.
Could somebody provide me an example code about using an arry in combination with a select case statement.
What i would like to achieve is that when i'm using a lookup table, the array should be filled with those values. Then in the select statement, the array would be the case.
This way i don't have to hardcode any data-values in vba.
The purpose of al this is having cleaner code.
For example:
I have a form where i insert physicaldata like length, weight, etc. and examinationsubject.
When i use a combobox for looking up the examintionsubject, the validationrule for weight must be set.
The criteria for this are examinationsubject, gender and the range where the weightvalue is valid (between 5500 and 9000).
the should be like
array(1 month, 2 month, etc.) 'filled by the a lookup table
select case array(1 month) and array(male)
case some value in the array
weight.validationrule = between (some value in the lookuptable) and (some value in the lookup table)
length.enabled = false (depending of the case)
I hope i was clear about my explaination.