473,671 Members | 2,504 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 1322
NeoPa
32,569 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
1391
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 part number. Form 2 Has menu options like File Open, NEW, SAVE, PRINT
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) and can not figure out how to hide and show forms. my project presently has a few forms but i can only the startup form is visible. i can't hide the startup form or show the other forms. i would like to hide a form when a button is pressed and...
8
579
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
6
1912
by: Davids | last post by:
this was impossible to implement on old ASP, is it the same for .Net?
0
763
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 A, but B is also open, sometimes A is set behind, and B appears on top of A. Amazingly, B doesn't get the focus, the focus is still in A. It's just that B appears on top of A (B's menubalk is still gray).
2
954
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 sometimes the focus is returned to a background app, and not the main app. My code to show the next form: Private Sub btnStock_Click(ByVal sender As System.Object, ByVal e As
0
4751
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 then clicking on any of th screens or tray icon it should stop. I tried the following (To start it on pressing escape on form1 and end it when escape is again
2
2363
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 within each panel also have separate ValidationGroups defined. When an asp:Textbox has focus in one of the Panels and I press the enter key, my validation works great. If I press the enter key a second time, the first button on the page's onClick...
3
4092
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 one for a certain bulletin list, however asp.net allows only one form per page with runat="server" attribute, I am aware of the visibility issue and that I can hide all of the forms except one but this won't help cause I need all of the three forms...
0
814
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 entered by the user between them. I've tried adding a public integar to the first form and assigning a value using a method, e.g.: public int myInt = new int(); public void myMethod() {
0
8483
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8927
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8605
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8676
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6237
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
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 we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.