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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional formula

Status
Not open for further replies.

ForMe2

Technical User
Jan 16, 2007
15
0
0
US
I need a formula that will multiply a different variable to a field based on the owner of the product and a specific date range. I am using some fields from access that are a date/time field. I'm trying to convert them to a date field.

This is what I have so far. There are no errors in the formula, but it isn't doing what I want it to do.

If {tbl_1.Owner}="Owner 1" and CDate({tbl_2.Date})<CDate(5/1/06)and {tbl_2.Date}>CDate(2/1/07) then
formula=(0*{tbl_3.Qty})
end if
 
ForMe2,
[pc2]
I think there are a few errors in the Formula you have posted.
1) no CDate function on the second Date field
2) I think you have your less than and greater than signs flipped... your IF can never be true as posted.
3)Possibly need parenthesis around the whole expression

Try:
Code:
[blue]Shared NumberVar[/blue] Result;
[blue]IF[/blue] ({tbl_1.Owner}="Owner 1" [blue]AND CDate[/blue]({tbl_2.Date}) < [blue]CDate[/blue](5/1/06) [blue]AND CDate[/blue]({tbl_2.Date}) < [blue]CDate[/blue](2/1/07)) [blue]THEN[/blue]
Result:=0*{tbl_3.Qty}

you could also have
Code:
Result:=0
as anything multiplied by 0 is 0.
Hope This Helps,

Mike
______________________________________________________________
[banghead] "It Seems All My Problems Exist Between Keyboard and Chair"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top