我想在 Form_Load 上循环一些 VBA 代码,它将根据其他 2 个字段更新我的表单中的一个字段。目前它只会更新第一条记录或当我点击一条记录时。
目前它看起来像这样:
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
也许有更好的方法来做到这一点?