I want the feild total to display the total cost of an item, If the item has vat a yes no box is ticked in the field vat and I have the price of the item without vat. I want the feild total to display [price]*vat rate if the vat box is ticked and I want it to display the [price] if the vat box is not ticked but i'm at a loss as to what to do any help?
making a feild conditional upon another
Collapse
X
-
Tags: None
-
Do you want to do this using a form or to default the value for new records in a table. For existing records you will have to run an update query.Originally posted by Richard GilmoreI want the feild total to display the total cost of an item, If the item has vat a yes no box is ticked in the field vat and I have the price of the item without vat. I want the feild total to display [price]*vat rate if the vat box is ticked and I want it to display the [price] if the vat box is not ticked but i'm at a loss as to what to do any help?
Let me know and I'll provide instructions. -
Richard don't send me PM's reply to the postOriginally posted by mmccarthyDo you want to do this using a form or to default the value for new records in a table. For existing records you will have to run an update query.
Let me know and I'll provide instructions.Comment
-
OKOriginally posted by mmccarthyDo you want to do this using a form or to default the value for new records in a table. For existing records you will have to run an update query.
Let me know and I'll provide instructions.
Make the default value of the field as follows:
=IIf(vat="Yes",[price]+(([price]*17)/100), [price])
I used 17% as I don't know what your vat rate is.Comment
-
-
yeah I have a feild called vat and priceOriginally posted by mmccarthydo you have a field in your table called vat?Comment
-
ok that will do if thats the case what is the method behind thatOriginally posted by mmccarthyIts probably not going to allow you to set a conditional default value in the table. You will have to look at doing it in a form.Comment
-
In a data entry form based on the table. Put an AfterUpdate event on the vat textbox as follows. You will need to put the same code in the AfterUpdate event of the price field.
Code:Private Sub vat_AfterUpdate() Me.TotalPrice =IIf(Me.vat="Yes",Me.price+((Me.price*17)/100),Me.price) End Sub
Comment
-
Originally posted by mmccarthyIn a data entry form based on the table. Put an AfterUpdate event on the vat textbox as follows. You will need to put the same code in the AfterUpdate event of the price field.
Code:Private Sub vat_AfterUpdate() Me.TotalPrice =IIf(Me.vat="Yes",Me.price+((Me.price*17)/100),Me.price) End Sub
Thanks managed to get it sortedComment
Comment