473,513 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple Forms or Hide Controls?

15 New Member
I have a database related to 3rd - 6th grade students and their end-of-year testing.

There are four possible tests (Math, Language Arts, Science, Social Studies). No grade takes all four tests. They either take two or three out of the four possible and each grade is different, though there is some overlapping. The information for each test is displayed in columns under the testing subject column header.

I want to display, on a Form, only the testing information related to the specific grade. So, if 3rd grade students take a Math and Language Arts test I only want to display the information for those two tests. I'm vacillating between two ways to go about this:
  1. Create four separate Forms specific to each grade.
  2. Create one Form with all four columns and just hide the column header and controls for those subjects not needed for the grade being displayed.
The problem with the first method is there is more to try to maintain if any changes come along, which does tend to happen due to changes that come from the state Board of Education that are beyond my control (they never seem to be able to make up their mind regarding testing).

If I use the second method I don't particularly like the appearance since it can look like a smile with missing teeth depending on the grade.

My initial feeling was to just create the four separate Forms so I could better control how they look to the user. I'd rather not have them complain about the visual gap between the tests for those grades that would have one.

Does anyone have a suggestion on how I might make this decision? I'm sure there are more than two ways to go about this, so if there is another alternative I'm open to that, as well.

Thank you!
Mar 1 '16 #1
3 1311
NeoPa
32,557 Recognized Expert Moderator MVP
Why not use sub-forms within a Tab-Control?

Each sub-form would be on a separate Page (of the Tab-Control) and use the same form with different settings. Only those which are required need be visible. Invisible Pages leave no gap.
Mar 2 '16 #2
mbizup
80 New Member
Seconding NeoPa's suggestion for subforms. A common layout when dealing with multiple subforms is to use a tab control on the main form, and place each subform on a separate page of the tab control. With this approach, only the subform on the currently selected tab/page displays at any given time.
Mar 2 '16 #3
jforbes
1,107 Recognized Expert Top Contributor
This is probably overkill for what you are wanting to do...

I have a similar situation where we use a "View" (not to be confused with a query or SQL View) that shows the user only specific columns for a SubForm. It also manages which columns are editable. This "View" is selected by the user based on what roll they are performing, so that they only see the information that they are interested in and only edit the columns that they should. It also addresses the "smile with missing teeth" problem by moving the controls to the left and removing any space between the controls.

This "View" functionality is data driven, so the function to hide/show controls is stored in a Module and can be applied to any Form/View combination. Here is the function to apply the Form/View. I doubt you would want to use it as is, but it might give you an idea or two:
Expand|Select|Wrap|Line Numbers
  1.     'applyFormView
  2. Public Function applyFormView(ByRef oForm As Form, ByRef sFormViewName As String, ByVal dHeight As Double) As Boolean
  3.     On Error GoTo ErrorOut
  4.  
  5.     Dim oRst As DAO.Recordset
  6.     Dim sSQL As String
  7.  
  8.     Dim iTabOrder As Long
  9.     Dim iSpacing As Integer
  10.     Dim lLeft As Long
  11.  
  12.     Dim sFormName As String
  13.     Dim sLabel As String
  14.  
  15.  
  16.     iTabOrder = 1
  17.     iSpacing = 30
  18.     lLeft = 20
  19.  
  20.     sFormName = oForm.Name
  21.  
  22.     ' Determine Control Height
  23.     If dHeight <> 0 Then oForm.Detail.Height = (dHeight * 1440)
  24.  
  25.     ' Get View and reorder the Form
  26.     sSQL = ""
  27.     sSQL = sSQL & "SELECT FormViewControls.* "
  28.     sSQL = sSQL & "FROM FormViewControls "
  29.     sSQL = sSQL & "WHERE FormName='" & sFormName & "' "
  30.     sSQL = sSQL & "AND FormViewName='" & sFormViewName & "' "
  31.     sSQL = sSQL & "ORDER BY DisplayOrder "
  32.     Set oRst = CurrentDB.OpenRecordset(sSQL, dbOpenDynaset, dbForwardOnly + dbSeeChanges)
  33.         If oRst.RecordCount > 0 Then
  34.             While Not oRst.EOF
  35.                 If Not oRst!Ignore Then
  36.  
  37.                     sLabel = Nz(oRst!ControlLabelName, "")
  38.  
  39.                     If oRst!Visible <> 0 Then
  40.                         ' Show Control and Label
  41.                         oForm.Controls(oRst!ControlName).Visible = True
  42.                         If Len(sLabel) > 0 Then
  43.                             oForm.Controls(sLabel).Visible = True
  44.                             oForm.Controls(sLabel).Width = oForm.Controls(oRst!ControlName).Width
  45.                         End If
  46.  
  47.                         ' Move Control into Position
  48.                         oForm.Controls(oRst!ControlName).Left = lLeft
  49.                         If Len(sLabel) > 0 Then oForm.Controls(sLabel).Left = lLeft
  50.  
  51.                         ' Set Height
  52.                         If dHeight <> 0 Then
  53.                             Select Case oForm.Controls(oRst!ControlName).ControlType
  54.                                 Case acComboBox, acTextBox
  55.                                     oForm.Controls(oRst!ControlName).Height = (dHeight * 1440)
  56.                                 Case Else
  57.                             End Select
  58.                         End If
  59.  
  60.                         ' Enable or Disable
  61.                         If oForm.Controls(oRst!ControlName).ControlType <> acCommandButton Then
  62.                             If oRst!Enabled = 0 Then
  63.                                 oForm.Controls(oRst!ControlName).Locked = True
  64.                                 If Len(sLabel) > 0 Then oForm.Controls(sLabel).BackColor = mColorAccessTheme2
  65.                             Else
  66.                                 oForm.Controls(oRst!ControlName).Locked = False
  67.                                 If Len(sLabel) > 0 Then oForm.Controls(sLabel).BackColor = mColorRequired
  68.                             End If
  69.                         End If
  70.  
  71.                         ' Tab Order
  72.                         oForm.Controls(oRst!ControlName).TabIndex = iTabOrder
  73.                         iTabOrder = iTabOrder + 1
  74.  
  75.                         lLeft = lLeft + oForm.Controls(oRst!ControlName).Width + iSpacing
  76.                     Else
  77.                         ' Hide Control
  78.                         oForm.Controls(oRst!ControlName).Visible = False
  79.                         If Len(sLabel) > 0 Then oForm.Controls(sLabel).Visible = False
  80.                     End If
  81.                 End If
  82.  
  83.                 oRst.MoveNext
  84.             Wend
  85.         End If
  86.  
  87.     If dHeight <> 0 Then oForm.Detail.Height = (dHeight * 1440)
  88.     applyFormView = True
  89.  
  90. ExitOut:
  91.     oRst.Close
  92.    Exit Function
  93.  
  94. ErrorOut:
  95.     ' Removed error handling
  96.     msgbox err.description
  97. End Function
Mar 2 '16 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1370
by: Suresh Kumaran | last post by:
Hi Everyone, I have an application in the following order. Form 1 - User Enters Part Number. After certain basic validation against the file, Form 2 is show with details pertaining to the...
1
385
by: Don | last post by:
hi in the past (vb 5.0) is used to create applications with multiple forms. i would hide and/or show the appropriate form depending on user input. now i'm using vb.net (still getting used to it)...
8
579
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
6
1909
by: Davids | last post by:
this was impossible to implement on old ASP, is it the same for .Net?
0
753
by: Steven | last post by:
Hello, I have an application with multiple forms. I open 2 (different) forms, one with numerous controls, say A, and one with a MonthCalendar, a Combobox and a datagrid, say B. When I work in...
2
948
by: pkruger | last post by:
Hello, My application makes use of multiple forms. The problem is that if one form is loaded and shown, and I close this form to go back to the previous form, the previous form is displayed, but...
0
4736
by: question | last post by:
Hi! I have a requirement where I need to display multiple forms one after the other like a slide show. These are in the same application. Basicall on selection of a menu item it should start...
2
2357
by: Darren Carter | last post by:
Hi, I have mutliple asp:Panel controls on a single page, each with a default button defined (each default button resides within its respective asp:Panel). All validation controls and buttons...
3
4083
by: Yehia A.Salam | last post by:
hello, I have to deal with the weird limitation of asp.net, as I need to have multiple forms on my page, well three at least actually, one for the login, one for the search engine, and another...
0
807
by: Demonweare | last post by:
Beginner Alert! How do I access public members from different classes at runtime? For example, I have a C#.NET project that uses multiple forms and I need to be able to get values from controls...
0
7257
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7157
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7521
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5084
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.