[AccessD] A strange situation

A.D. Tejpal adtp at airtelmail.in
Fri Apr 30 13:39:21 CDT 2010


J.C.,

    It is presumed that the subform carrying the check boxes representing various groups is an unbound one, serving as a convenient means for setting permissions, which get stored in bound text boxes on parent form.

    Prima-facie, it should be feasible to accomplish the stated objective without resorting to any tab control. In fact even the subform could be dispensed with and all the unbound check boxes placed on the main form itself.

    As and when any of the pertinent text boxes becomes the active control, the status of check boxes gets synchronized accordingly. Correspondingly, as soon as a check box is clicked, the composite value in pertinent text box gets updated simultaneously, without waiting for any exit from the subform.

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

  ----- Original Message ----- 
  From: jwcolby 
  To: Access Developers discussion and problem solving 
  Sent: Friday, April 30, 2010 00:18
  Subject: [AccessD] A strange situation


  I have a security system where there are groups of users.  Each group is represented by a bit position in a long integer.  1 = GroupA, 2 = GroupB, 4 = GroupC etc.

  I have a form which has 32 check boxes on it.  These check boxes represent the bit positions in a long integer.  IOW each bit position represents a group.  The form has methods to take a long integer and set / clear the associated check box as well as hide / display check boxes.

  All of that works.

  The form with the check boxes will be a subform on a parent form that allows the user to set security for a specific form.  This parent form displays records in a table.  The records have a form name, and long integer fields for AllowEdit, AllowDelete etc.

  The parent form form thus has five text boxes representing the properties of a form - Visible, AllowEdit, AllowDelete, AllowInsert etc.  Each text box will display a long integer which represents the OR of a set of groups which can perform the operation.

  As I click into one of these text boxes I need to make the "checkbox" subform "visible".  I may click into that subform and click check boxes representing bit positions which are groups that can perform that operation (allowedits etc).

  Or... I may click into another of the text boxes.

  As I click into the text box, the subform displayed has to set / clear the check boxes representing the groups contained in the bit positions of the long integer contained in the text box.

  Simple enough eh?

  The problem is making visible just the subform for the "current" text box.  The only way I can think of to do this is a tab control which is kind of clumsy but works.  Place an instance of the check box subform on a tab, one tab for each property.  As the user clicks into one of the "property" text boxes, the correct tab is selected, displaying the subform for that text box.

  One problem is that as the user clicks OUT of the subform, the check box values have to be rolled back into a long integer and placed into the correct text box for that subform.  The subform itself has a method that performs this rollup and hands back the long integer, the problem is that the OnExit of the subform has to do the placement of the long integer into the associated text box.

  This is turning into a lot of very ugly code in the parent form module.  This is begging for a class solution to compartmentalize the code but things are getting intertwined.  OnEnter of the text box has to call its subform and pass it the long integer it contains.  OnExit of the subform control has to know what text box to pass the value back to.  OnEnter of the text box has to select the correct tab of the tab control.

  Whooo doggy, things are getting fun.
  -- 
  John W. Colby
  www.ColbyConsulting.com


More information about the AccessD mailing list