Vlaidation rule help!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am currently working on creating validation rules for an order form for m y
database but I have become unable to allow Access to accept it. What I
wanted the entity to do was work out...
If the subtotal is less than £10.00 then enter £3.00 otherwise, enter £0.00
I tried entering the following...
=IF [Subtotal_2] <£10.00 THEN £3.00 IF [Subtotal_2] >£10.00 THEN £0.00
but that didn't work so i took about the pounnd signs, still nothing... so i
tried
=IF [Subtotal_2] <£10.00 THEN £3.00 ELSE £0.00
Nothing!
Please help me!
 
It deosn't really sound like a validation rule, but maybe I am missing
something. It sounds like there is a shipping charge of £3.00 for orders
under £10.00, and none for orders over £10.00, or something like that.
Validation would be to assure a field is filled in, or to ask for additional
action if the number is below a certain amount, or something like that. Is
this in a query or in a control, or is it VBA? As the Control Source for a
text box you would use IIf:
=IIf([Subtotal_2] < 10,3,0]

You would also use IIf if you are creating a query field, but with slightly
different syntax:
FieldName: IIf([Subtotal_2] < 10,3,0]

Both examples assume that [Subtotal_2] and the control (text box, I assume)
in which the result appears are fomatted as currency with two decimal
places.

In VBA you would use If:
If [Subtotal_2] < 10 Then
Me.YourTextBox = 3
Else
Me.YourTextBox = 0
End If

Without knowing more about your database it is difficult to know where this
code would go, but I expect that it would be in the After Update event of
any of the controls that contribute to [Subtotal_2].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top