conditional calculated field

G

Guest

How do I perform this conditional calculated field in a query or form

if disposition = "booked" then tot=price*quan

I want all the records displayed even if disposition<> "booked".

I tried IIF [disposition = "booked"],price*quan. I got #name
Thanks for the help.
 
D

Dirk Goldgar

******** said:
How do I perform this conditional calculated field in a query or form

if disposition = "booked" then tot=price*quan

I want all the records displayed even if disposition<> "booked".

I tried IIF [disposition = "booked"],price*quan. I got #name
Thanks for the help.

In addition to correcting your syntax for calling IIf(), you have to
decide what you want to appear in the field if disposition<> "booked".
Let's suppose that you want 0 to show in that case. Then you could use
the following expression in the controlsource of a textbox:

=IIf([disposition]="booked", [price]*[quan], 0)

Or you could define it as a calculated field in the form's recordsource
query:

tot: IIf([disposition]="booked", [price]*[quan], 0)
 

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