Full Version: Micosoft Access Validation Help
UtterAccess Discussion Forums > Microsoft® Access > Access Tables + Relationships
hezperez
I have an Orders table which needs to be able to calculate... if the subtotal is less than 10.00 then enter 3.00 else enter 0.00 i have tried and tried but it just won't work! Could somebody PLEASE help me! Thank you
dashiellx2000
Hello and welcome to UA.

What you are attempting to do is store a calculated field and this is not what you want to do. You can accomplish this in a query for use in a form or report. Data validation should be done on the form level, not the table level.

HTH.
rsindle
I assume that you are using an OrderDetails type table to store individual line items of the order.
I'm guessing that you have a subform containing these line items in continuous mode.
If so, its easy to sum the values and put the value in a control on the subform.
lets assume the control is called "txtTotal" and the field you are summing is called "LineItemCost"
in the control source put:

=Sum([LineItemCost])

I assume that you are saying "If the order is less than $10 add a $3. surcharge" or something to that effect.
If you put a button on the form that says "Calculate total"

You can then say
If me.txtLineItemCost < 10 then
me.txtAddon = 3
else
me.txtAddon = 0
endif
Where you store it can be as another row in the details table or at the order table level, up to you.
Hope this helps.
Rob
rsindle
Sorry, got interrupted and mistyped the following:
It SHOULD have said:

If me.txtTotal< 10 then
me.txtAddon = 3
else
me.txtAddon = 0
endif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.