Every time I have to make changes in it, I wind up with a splitting headache from trying to figure out what it's written the way it is, but this week, I found the crown jewel of this entire dysfunctional train wreck. There's a part of the process where if a bird has a defect, the user pushes a button which brings up a smaller form with ten command buttons with numbers 0-9.
The layout is completely nonstandard:
...but the worst part is, the numbers assigned to each button at design time are NOT the values returned by pushing the buttons... instead, the value of each button changes when the form is loaded so that when you click a defect button, the most common value for that defect comes up right where you clicked to get the "score" form.
Here's how it's done:
Private Sub Form_Load() ' This procedure runs when the form loads. Dim rst As DAO.Recordset Dim intOpt As Integer Me.Caption = "Defect Score - " & Me.OpenArgs Set rst = Me.Recordset For intOpt = 0 To 9 With Me.Controls("opt" & intOpt) If IsNull(rst("D" & intOpt)) Then .Visible = False Else .Caption = rst("D" & intOpt) .OptionValue = rst("D" & intOpt) End If End With Next intOpt End Sub
What is this load event doing, you ask? Why, it's simple: we're looking in a datatable which contains columns D0-D9. In those columns is a number, also 1-9, which this sub uses to determine what value each command button in the form takes on. For example, in the images below, that same form is displayed after clicking two different defect buttons. We didn't MOVE the buttons around, we just changed the values of the buttons put there at design time to get the demented layout we're going for.
I can't imagine how anyone could have paid money for this application, or how a profit seeking entity could have possibly thought it was ok to design an interface like this. Makes me tear my hair out every time someone makes me work on this.