View Single Post
 
Old October 17th, 2005, 03:35 PM
Corey Corey is offline
Friend of Wrox
 
Join Date: Sep 2005
Location: , , USA.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Corey
Default

I'm just starting out with VBA. is there a way you can exsplain this to me?


Quote:
quote:Originally posted by Figgis
 I think in this instance I would write a new event which handled the actual calulations which could then be called if your criterea was met.

I'm only just geting into VBA so this might not work. I used to program with small talk and that is totally different. I would try something like:-

Private Sub Discount()

Dim Qty As Integer
Dim Retail As Ineteger
Dim Cost As Integer

Qty = (Me!.Qty.Value/(Sum(IIf([OL_PRICE]*([OL_QTY_ORD]-[OL_QTY_CAN_TD])=0,0,([OL_QTY_ORD]-[OL_QTY_CAN_TD])))))

Retail =(Me!.Retail.Value/(Sum(([OL_PRICE]*([OL_QTY_ORD]-[OL_QTY_CAN_TD]))))

Cost =(Me!.Cost.Value/(Sum([OL_DMD_COST]*([OL_QTY_ORD]-[OL_QTY_CAN_TD]))))

Me!.Field_1.Value= Qty

Me!.Field_2.Value= Retail

Me!.Fiels_3.Value= Cost

End Sub


Then use your IIf([Buyer]="Diana Grover",Call Discount,(you need to choose what to do if the buyer isn't Diana Grover))

As I say I'm not used to VBA yet so some of the other guys on here might be able to phrase this a bit better.

The other thing that springs to mind is that you are being very presise in selecting one buyer to apply this condition to. Would it not be better to have the option to apply this to other people and that way save yourself a bit of work if it does become neccesary. Just a thought.