Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert data into table 1

Status
Not open for further replies.

rogerarce

Technical User
Jan 24, 2002
57
CR
I have a table called tblcars with the following fields:
car,model,price and tax. I made a form from it with the
same fields, except that label TAX in the form is
calculated and has the following formula:
=iif([MODEL]>=A,[PRICE]*0.005,iif([MODEL]<=B,[PRICE]*0.0010))

MODEL could be form A to Z but I only want this operation to
happen on models A and B. Everything works fine, but when I
go the table tblcars the field TAX is empty!

Thanks in advanced for your help!

Roger
 
The first thing I see is that you need quotation marks &quot;&quot; around the A and B, so that the iif functionss can evaluate correctly. Also, do you mean to have nested iif functions? These functions need both true and false options and I don't see them. Hope thios helps.
 
=iif([MODEL]=&quot;A&quot;,[PRICE]*0.005,iif([MODEL]=&quot;B&quot;,[PRICE]*0.0010,0),0)

is the iif statement that will work. I added the quotes and the zeros, which are tell access what to put in if the criteria are not met, and got rid of the greater than and less than, which would just slow things down here.

But why are you calculating value here _and_ storing it in the table? I would say it makes more sense to just calculate it when you need it. Otherwise, if things change you will have to go back and change all of your records. As it is, you're storing a calculated value, and that's clearly in violation of rules of normalization.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access databases since 1995.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top