Subform switching Form_Load?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsmccli
    New Member
    • Jan 2008
    • 52

    Subform switching Form_Load?

    AC2002

    I have a main form with several tabbed subforms/child windows. I am in the process of creating nearly identical sub-forms, except with more available fields, for Admins. I was wondering if there was a way for Access to recognize an Admin and automatically load the less-restrictive sub forms for use, I am thinking in the Form_Load event of the main form.

    I think I already have a function for returning True/False if a user belongs to a certain usergroup, just unsure of how to do the other part.


    Thanks
    rsmccli
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Originally posted by rsmccli
    AC2002

    I have a main form with several tabbed subforms/child windows. I am in the process of creating nearly identical sub-forms, except with more available fields, for Admins. I was wondering if there was a way for Access to recognize an Admin and automatically load the less-restrictive sub forms for use, I am thinking in the Form_Load event of the main form.

    I think I already have a function for returning True/False if a user belongs to a certain usergroup, just unsure of how to do the other part.


    Thanks
    rsmccli
    Hi. As fas as I know it is not possible to load the subform at form load, but you can get the same end result by including both subforms on the form (one on top of the other) and setting the visible property of each to true or false in the form load event according to the result of your admins function:

    [code=vb]Dim IsAdmin as Boolean
    IsAdmin = YourAdminFuncti on()
    Me.[nonadminssubfor mname].form.visible = Not IsAdmin
    Me.[adminssubformna me].form.visible = IsAdmin[/code]
    -Stewart
    ps you can do the same with individual controls on a sub form if this would save you creating two nearly-identical forms. You could hide the extra controls and make them visible only to admins. Syntax is very similar:
    [code=vb]Me.[subformname].form!ctlname.v isible = IsAdmin[/code]
    Last edited by Stewart Ross; Mar 8 '08, 07:39 PM. Reason: added PS

    Comment

    Working...