jgoodman00
Programmer
- Jan 23, 2001
- 1,510
I wrote the code below in order to ascertain which value, either track or bldg is smaller. I need this to be appended to the control called RecmdedHeight, but I cannot make it do this. The values are retrieved correctly, & RecHeight eventually contains the correct result, but the code errors at line 13 (I have numbered the lines to make identification easier). Therefore my question is how do I make this product (RecHeight) populate the RecmdedHeight control on the form???
1 Private Sub Form_Current()
2 Dim track, bldg As Variant
3 Dim RecHeight As Single
4 Dim RecmdedHeight As Control
5 RecmdedHeight = Forms!frmTree!RecmdedHeight
6 track = DLookup("[Track]", "tblAdopt", "[RefNo] = Forms!frmTree!RefNo"
7 bldg = DLookup("[bldg]", "tblAdopt", "[RefNo] = Forms!frmTree!RefNo"
8 If track > bldg Then
9 RecHeight = bldg
10 ElseIf bldg > track Then
11 RecHeight = track
12 End If
13 RecHeight = RecmdedHeight
14 End Sub
1 Private Sub Form_Current()
2 Dim track, bldg As Variant
3 Dim RecHeight As Single
4 Dim RecmdedHeight As Control
5 RecmdedHeight = Forms!frmTree!RecmdedHeight
6 track = DLookup("[Track]", "tblAdopt", "[RefNo] = Forms!frmTree!RefNo"
7 bldg = DLookup("[bldg]", "tblAdopt", "[RefNo] = Forms!frmTree!RefNo"
8 If track > bldg Then
9 RecHeight = bldg
10 ElseIf bldg > track Then
11 RecHeight = track
12 End If
13 RecHeight = RecmdedHeight
14 End Sub