Tuesday, August 4, 2009

Ab-normalization at Experts Exchange - part 16

Question today: Change text box name with a variable

The problem:
I am coding a form in Access 2003 using VBA and SQL.
The form has 16 text boxes sequentially named txtBSCPIN1 to txtBSCPIN16.
When updating the table I need to see if there are values in each box like isnull(txtBSCPIN1) = True.
I don't want to have to write 16 ElseIf statements if I don't have to.

Is there a way to use a variable to change the number at the end of txtBSCPIN so I could then use a do loop to check all of the boxes.
Or is there a better way to do this.

The crappy solution:
Copy/paste code how to use a loop to dynamically check the text box value.

Obviously capricorn1 doesn't know that field names with a trailing number point to a not normalized approach.
Obviously capricorn1 doesn't read the Q as it states "Or is there a better way to do this."
Obviously capricorn1 doesn't know how to translate a Not-Normalized approach into a normalized way, that's using little or no VBA code.

The "normalized way" only requires:
1) A (temporary) table with 16 rows, one for each txtBSCPIN field.
2) An UPDATE query to set the BSCPIN fields to Null when opening the form and
3) An APPEND query selecting the "True" rows to be added to the target table.

As expected, this is again a "bridge too far" for this "would be" expert.
Still wonder why Experts-Exchange is so proud on their (self proposed) MVP experts and why Microsoft doesn't track their MVP's better for real quality solutions.
Hmm, not really surprised, after all both EE and MS are only interested in $$'s and not in their customers in the true American spirit.


Nic;o)
Still proud to be suspended from this "quality site" where wannabee experts rule and "quality" is just another word from the dictionary.
(The question can be found at: http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_24618166.html)

No comments:

Post a Comment