View Full Version : HELP WITH THIS CODE


danaleblanc
11-17-2001, 06:42 AM
Have a checkbox called RUSHORDER
Have a text box called UNITPRICE (formated in currency)
Need a code that will increase the value in UNITPRICE by 30% if RUSHORDER is selected.
Any help is appreciated.

Jack Cowley
11-17-2001, 07:00 AM
Where you put your code to do this depends on which action happens first. If the UnitPrice is filled in and then the Check box is check you will need the code in the After Update event of the Check box. If the Check box is ALWAYS checked first then this code in the After Update event of the UnitPrice field will work. You might want to use code in the Before Update event with a warning message to let the user know that the price is going to be increased. If they don't want the increase then they can exit without saving a price to the table.

Anyway, the code for the After Update event of the UnitPrice field will look like this:

If Me.RUSHORDER = -1 Then
Me.UnitPrice = Me.UnitPrice * 1.3
End if

[This message has been edited by Jack Cowley (edited 11-17-2001).]