One Form or Two seperat ones (1 Viewer)

Bigmo2u

Registered User.
Local time
Today, 16:03
Joined
Nov 29, 2005
Messages
200
One Form or Two seperate ones

I have 2 groups that access a form that looks the same in general. But one group enters more information than the other. I currently have two seperate forms. Would it be good practice to have it all on one form and have the fields/textboxes invisible to one group base on the userid (if i knew how to call the groups, I would do it that way). Seems like a lot of code to make 20 fields set to invisible for one group.

Reason for asking is I am trying to streamline or compact the DB (fewer Forms).


Thanks for your thought and seggeestions in advance.
 
Last edited:

missinglinq

AWF VIP
Local time
Today, 17:03
Joined
Jun 20, 2003
Messages
6,423
I'm not really sure of the value of "streamlining" a database by eliminating a form that's already been developed, tried and tested, but setting properties, such as Visibility, on a group of controls is fairly easy if you use the Tag property of the controls and loop thru all controls. If, for example, you want a set of controls to "disappear" when someone in GroupA signs in, in the Tag property for each control (Properties - Other) enter GroupA (no quotation marks,) then after determining that which group the user opening the form belongs to, use something like this:
Code:
Dim ctrl As Control

If UserGroup = "GroupA" Then
  Me.TextboxThatWillBeVisible.SetFocus
  For Each ctrl In Me.Controls
    If ctrl.Tag = "GroupA" Then
       ctrl.Visible = False
    End If
  Next
Replace TextboxThatWillBeVisible with the actual name of one of your controls that will still be visible after the disappearing act; if you try to set a control's Visibility to False while it has focus you'll pop an error.

This code needs to go in the Form_Load event, after you've determined which group the user belongs to.
 
Last edited:

Bigmo2u

Registered User.
Local time
Today, 16:03
Joined
Nov 29, 2005
Messages
200
missinglinq - Thanks for your reply. I understand what you are saying.
 

Users who are viewing this thread

Top Bottom