View Single Post
  #1 (permalink)  
Old October 8th, 2007, 10:18 PM
kypros79 kypros79 is offline
Registered User
 
Join Date: Oct 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default IIF Formulas used in Update queries

I am importing data from an old database (we call it AS400) into my Access'03 database. The data corresponds to price increases shown as follows...

     CustNum,P/C,PreviousPrice,FuturePrice,EffectiveDate
     80000,123456,0.1234,0.0000,
     80000,123457,0.1234,1.1234,10/01/2007

The system does not update the future price if there will not be a price increase (as shown above)... When there is a price increase, it does not show the increment, but the updated price. I used the IIF Formula to select the correct price...

     10/01/07: IIf([tblQuotes]![Increased]<>0,[tblQuotes]![Increased],[tblQuotes]![Previous])

In a select query, I get the desired result; one field labeled with the most recent price increase. But I would like to update these numbers to a table with a field named for the date of the most recent price increase. My intention would be to eventually track my price increases over time for various products and customers. I tried to use my IIF statement in an update query where the field to update to was named 10/01/07. That's when it crapped out... the error message reads,

     "'IIF([tblQuotes]![Increased]<>0,[tblQuotes]![Increased],
     [tblQuotes]![Previous])' Is not a valid name. Make sure that
     it does not include invalid characters or punctuation and that
     it is not too long."

I only get this message if I change my query type to an update query... which is what I *think* I want to do. Of course, that's where it gets dangerous... sheep who think. Can anyone give advice on how else I can store data as ONE field to track it every time I have a price increase? i've already searched for Update queries and IIF Formulas. I've seen lots of stuff out there but nothing directly related to my issue. Any help would be appreciated.
Reply With Quote