I want to loop some VBA code on Form_Load that will update one field in my Form based on 2 other fields. Currently it will only update the first record or when I click on a record.
Currently it looks like this:
Private Sub Form_Current()
If Style = "W" And Size = "120" Then ContainerType = 9
If Style = "W" And Size = "240" Then ContainerType = 2
If Style = "W" And Size = "360" Then ContainerType = 34
If Style = "R" And Size = "120" Then ContainerType = 37
If Style = "R" And Size = "240" Then ContainerType = 5
If Style = "R" And Size = "360" Then ContainerType = 12
If Style = "Y" And Size = "120" Then ContainerType = 24
If Style = "Y" And Size = "240" Then ContainerType = 4
If Style = "Y" And Size = "360" Then ContainerType = 14
If Style = ("2Y") And Size = "120" Then ContainerType = 9
If Style = ("2Y") And Size = "240" Then ContainerType = 25
If Style = ("2Y") And Size = "360" Then ContainerType = 28
If Style = ("3Y") And Size = "120" Then ContainerType = 9
If Style = ("3Y") And Size = "240" Then ContainerType = 51
If Style = ("3Y") And Size = "360" Then ContainerType = 29
End Sub
Perhaps there is a better way to do this?
ContainerType
values. Can you explain the mathematics behind this code? – Dai May 30 at 3:26