if and then if

  • Thread starter Thread starter PurplRose
  • Start date Start date
P

PurplRose

Guest
I need to write this but do not know the best way. Access 2000, in a report, in a Text Box.

I need something like this -->

this part I am not sure of at all
Private Sub Detail_???t(Cancel As Integer, FormatCount As Integer)
If
[LIST_CASE] = If ([pack] > 1, [CasePirce],Null)
then if
[LIST_CASE] = if ([CasePrice] = [BottlePrice], [CasePrice], null)



Private Sub Detail_???t(Cancel As Integer, FormatCount As Integer)
If
[LIST_BOTTLE] = If ([pack] > 1,Null, [BottlePrice])
then if
[LIST_BOTTLE] = if ([CasePrice] = [BottlePrice], null, [BottlePrice])

I am trying to do a work around. I did this database over 2 years ago. Asking as many questions as possible at the time. Now they are taking what I did in Access and inputting in to there AS400 for pricing. I have a the same price in the Case Price and the Bottle price if the Pack is = to 1. I need to keep that like it is for all the 60 reports that was done 2 years ago. The 60 reports are all done different and have one column for pricing depending on now they buy it from us. This new form has 2 columns. But only want to show the price how they buy it from us case or bottle cost.

Please help
Karen :confused:
 
Hi

I think you want something like this

= IIf (([pack] > 1),(iif([CasePirce]=[BottlePrice]),[CasePrice],"") ,"")

in the record source of the list_case field, or if you want to put it in code use this:


If ([pack] > 1) and ([CasePrice] = [BottlePrice], then
[LIST_CASE] = [CasePrice],
else
[list_case] = ""
endif


Repeat for [list_bottle] using the same logic.

I haven't actually tested the code but it should work.

Do come back to me if you need further help

Sue
 
More to if and then if

I just found out I need to add to this.

This is the quesions I need to ask something like this.

TodayCasePride = IIf [pack] > 1, then do [CasePrice] or [OldCasePirce] if [effecteddate] > Date(), if not do null

TodayBottlePrice = IIF ([pack] > 1, [ListCase], IIF ([CasePrice] = [BottlePrice], [CasePrice], Null)) or [OldCasePirce] if [effecteddate] > Date(), if not do null


Table-->
|code|Pack|CasePrice|BottlePrice|EffectedDate|OldCasePrice|OldBottlePrice|
| 200 | 12 | 12.00 | 1.20 | 12/1/03 | 11.40 | 1.15 |
| 222 | 1 | 12.00 | 1.20 | 12/1/03 | 11.40 | 1.15 |
| 300 | 12 | 12.00 | 1.20 | 8/1/03 | 11.40 | 1.15 |
| 333 | 1 | 12.00 | 1.20 | 8/1/03 | 11.40 | 1.15 |


Report
|code|Pack |TodayCasePrice|TodayBottlePrice|EffectedDate|NewCasePrice|NewBottlePrice|
| 200 | 12 | 11.40 | | 12/1/03 | 12.00 | |
| 222 | 1 | | 1.15 | 12/1/03 | | 1.20 |
| 300 | 12 | 12.00 | | 8/1/03 | | |
| 333 | 1 | | 1.20 | 8/1/03 | | |


Thanks
Karen
 

Users who are viewing this thread

Back
Top Bottom