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

Michael Mattys michael at mattysconsulting.com
Thu Aug 26 08:28:55 CDT 2010


Hi A.D.,

I changed the number to move in the loop to 10.
I haven't come upon a solution yet, but I do find this amusing!

Michael R Mattys
Business Process Developers
www.mattysconsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of A.D. Tejpal
Sent: Thursday, August 26, 2010 1:29 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Option Group's Control Collection - Weird Behavior

    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
  ------------
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list