C
Cadburys
Please help...
I have the following code in the after update event of a combo box. The
first 3 conditions are fine but with the last 3 if one zone is 2 and the
other is 10 then it is returning the 2 as the highest value. I have tried
declaring all variables as Integers but then the HighestZone is not updated
immediately and the message box pops up even with the first 3 conditions. Why
are the last 3 conditions NOT recognizing
values over 9 as being greater.
ZoneFrom = DLookup("[Zone]", "tblSuburbs", "[SuburbName] = '" _
& Forms!Bookings!SuburbFrom & "'")
If Me.ZoneTo = 1 And Me.ZoneFrom = 1 Then
Me.HighestZone = 1
Me.Additional = 0
ElseIf Me.ZoneFrom = 1 And Me.ZoneTo > 1 Then
Me.HighestZone = ZoneTo
Me.Additional = 0
ElseIf Me.ZoneTo = 1 And Me.ZoneFrom > 1 Then
Me.HighestZone = Me.ZoneFrom
Me.Additional = 0
ElseIf Me.ZoneTo <> 1 And Me.ZoneFrom <> 1 And Me.ZoneTo > ZoneFrom Then
Me.HighestZone = ZoneTo
MsgBox "Neither the pick up nor the drop off are within Zone 1,
an additional cost will added to the normal rate. Please ammend the
additional cost if necessary.", vbOKOnly, "No Zone 1"
Me.Additional = 50
ElseIf Me.ZoneFrom <> 1 And Me.ZoneTo <> 1 And Me.ZoneFrom > Me.ZoneTo
Then
MsgBox "Neither the pick up nor the drop off are within Zone 1,
an additional cost will added to the normal rate. Please ammend the
additional cost if necessary.", vbOKOnly, "No Zone 1"
Me.HighestZone = ZoneFrom
Me.Additional = 50
ElseIf Me.ZoneTo <> 1 And Me.ZoneFrom <> 1 And Me.ZoneFrom = Me.ZoneTo
Then
MsgBox "Neither the pick up nor the drop off are within Zone 1,
an additional cost will added to the normal rate. Please ammend the
additional cost if necessary.", vbOKOnly, "No Zone 1"
Me.HighestZone = ZoneTo
Me.Additional = 50
End If
End Sub
Any help would be appreciated.
I have the following code in the after update event of a combo box. The
first 3 conditions are fine but with the last 3 if one zone is 2 and the
other is 10 then it is returning the 2 as the highest value. I have tried
declaring all variables as Integers but then the HighestZone is not updated
immediately and the message box pops up even with the first 3 conditions. Why
are the last 3 conditions NOT recognizing
values over 9 as being greater.
ZoneFrom = DLookup("[Zone]", "tblSuburbs", "[SuburbName] = '" _
& Forms!Bookings!SuburbFrom & "'")
If Me.ZoneTo = 1 And Me.ZoneFrom = 1 Then
Me.HighestZone = 1
Me.Additional = 0
ElseIf Me.ZoneFrom = 1 And Me.ZoneTo > 1 Then
Me.HighestZone = ZoneTo
Me.Additional = 0
ElseIf Me.ZoneTo = 1 And Me.ZoneFrom > 1 Then
Me.HighestZone = Me.ZoneFrom
Me.Additional = 0
ElseIf Me.ZoneTo <> 1 And Me.ZoneFrom <> 1 And Me.ZoneTo > ZoneFrom Then
Me.HighestZone = ZoneTo
MsgBox "Neither the pick up nor the drop off are within Zone 1,
an additional cost will added to the normal rate. Please ammend the
additional cost if necessary.", vbOKOnly, "No Zone 1"
Me.Additional = 50
ElseIf Me.ZoneFrom <> 1 And Me.ZoneTo <> 1 And Me.ZoneFrom > Me.ZoneTo
Then
MsgBox "Neither the pick up nor the drop off are within Zone 1,
an additional cost will added to the normal rate. Please ammend the
additional cost if necessary.", vbOKOnly, "No Zone 1"
Me.HighestZone = ZoneFrom
Me.Additional = 50
ElseIf Me.ZoneTo <> 1 And Me.ZoneFrom <> 1 And Me.ZoneFrom = Me.ZoneTo
Then
MsgBox "Neither the pick up nor the drop off are within Zone 1,
an additional cost will added to the normal rate. Please ammend the
additional cost if necessary.", vbOKOnly, "No Zone 1"
Me.HighestZone = ZoneTo
Me.Additional = 50
End If
End Sub
Any help would be appreciated.