[AccessD] Option Group's Control Collection - Weird Behavior

A.D. Tejpal adtp at airtelmail.in
Thu Aug 26 00:28:37 CDT 2010


    Further to my previous post, I would like to add that the anomaly is confined to manipulation of top property, if the toggle buttons are in same horizontal alignment to start with. No problem with left property.

Best wishes,
A.D. Tejpal
------------

  ----- Original Message ----- 
  From: A.D. Tejpal 
  To: Access Developers discussion and problem solving 
  Sent: Wednesday, August 25, 2010 21:24
  Subject: Option Group's Control Collection - Weird Behavior


  Something to alleviate current quiet phase in AccessD
  ====================================

      It is observed that if subcontrols (say toggle buttons) belonging to an option group are accessed via For Each loop, there is no problem so long as original position of these subcontrols is not disturbed.

      However, if programmatic manipulation (say by adding 1 twip to subcontrol's top property) is attempted, only some of the subcontrols get acted upon (some amongst them multiple times) while others get skipped. Total number of hits still adds up to the total count of such subcontrols. This weird pattern persists even if the subcontrols are accessed via item index, using For Counter = 0 to CollectionCount -1 (instead of for each loop). 

      Sample code used for conducting such a test is given below (Access 2003 desktop on Win XP):

  ' Sample code in VBA module of form
  ' having an option group named Opg_A
  '==========================
  Private Sub P_OpnGrpTest()
      Dim ct As Access.Control
      
      For Each ct In Me.Opg_A.Controls
          ct.top = ct.top + 1
          Debug.Print ct.Name, ct.top
      Next
      
      Set ct = Nothing
  End Sub
  '==========================

      Interested members might like to examine and offer their considered views regarding:
      (a) The likely explanation for such behavior.
      (b) Suggested optimum solution.

      I have two alternative solutions in mind. These are not being included at this stage so that the topic gets fresh treatment in a wider perspective.

  Best wishes,
  A.D. Tejpal
  ------------


More information about the AccessD mailing list