Macro help!

H

horde

Hi,

I hope someone can help me, whit my problem.

There is an number field (User ise typing a price). I need a macro to
check if typed number is between 0-2000 or 2000-5000 or 5000-10000.
If it is between 0-2000 then = typed price + 1000
When 2000-5000 then = typed price + 1500
When between 5000-10000 then = typed price + 2000

Form
.........................................................................
(Examle)
Typed price 2200
Price 2 3700

Thanx for any help.
 
T

tina

set a conditional macro, with three action lines, as

<on the first line>
MacroName: FixValue
Condition: [PriceControlName] Between 0 And 2000
Action: SetValue
Item: [PriceControlName]
Expression: [PriceControlName] + 1000

<on the second line>
Condition: [PriceControlName] Between 2001 And 5000
Action: SetValue
Item: [PriceControlName]
Expression: [PriceControlName] + 1500

<on the third line>
Condition: [PriceControlName] Between 5001 And 10000
Action: SetValue
Item: [PriceControlName]
Expression: [PriceControlName] + 2000

replace PriceControlName with the correct name of the control bound to the
price field, of course.

hth
 
S

Steve Schapel

Horde,

I feel it would be better not to use a macro to assign these values.
Since your 'Price 2' is directly derived from your 'Typed price', I feel
you should leave your 'Typed price' as entered, as the value that is
stored in your table. And then, whenever you need the 'Price 2' value,
use a calculation "on the fly" to show it. This can be done in a
calculated field in a query, or a calculated control on your form or
report. I would do it something like the equivalent of this...
Price 2: [Typed price]+IIf([Typed price]<2000,1000,IIf([Typed
price]<5000,1500,2000)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top