By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,966 Members | 1,913 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,966 IT Pros & Developers. It's quick & easy.

If...then...else?

P: n/a
I need a procedure for a DeliveryCharge field value of $0, the
MaxDistance field value must equal 0. if the DelivelryChare field value
is invalid, then i'm to display the appropriate message, cancel the
event, undo the change, and move the focus to the DeliveryCharge field
and no specila steps are taken for other DeliveryCharge field values....

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
spirit wrote:
I need a procedure for a DeliveryCharge field value of $0, the
MaxDistance field value must equal 0. if the DelivelryChare field
value is invalid, then i'm to display the appropriate message, cancel
the event, undo the change, and move the focus to the DeliveryCharge
field and no specila steps are taken for other DeliveryCharge field
values....


The best place to do validation is in the BeforeUpdate event of the control.
One of the advantages is that this event has a Cancel argument. When you set
Cancel = to True the update is actually cancelled and focus never leaves the
control so there is no need for code to set the focus back. In your case...

DeliveryCharge_BeforeUpdate (Cancel As Integer)

If Me!DeliveryCharge = 0 _
And Me!MaxDistance = 0 Then
MsgBox "Invalid Entry"
Cancel = True
Me!DeliveryCharge.Undo
End If

End Sub

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.