Reputation: 350
I have a procedure to that checks multiple textboxes on a form (but not all) to see if they're null, and currently I am using this code:
If IsNull(control1) Or IsNull(control2) Or IsNull(control3)... etc
Is there a way to concisely check multiple textboxes for null values without Or
operators?
Upvotes: 1
Views: 2010
Reputation: 97101
The sum of Null plus any non-Null value is Null. So add those control values and if one or more of them is Null, the sum will be Null:
If IsNull(control1 + control2 + control3) Then
Upvotes: 2
Reputation: 27634
No, that's as concise as it gets.
If you really want, you can build your own function using ParamArray.
See Optional Parameters To Procedures (second part ParamArray Parameter Type)
Upvotes: 1