A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

conditional calculated field



 
 
Thread Tools Display Modes
  #1  
Old November 3rd, 2004, 07:25 AM
********
external usenet poster
 
Posts: n/a
Default conditional calculated field

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.
  #2  
Old November 3rd, 2004, 07:35 AM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"********" wrote in message

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)

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do a get a report to sort on a calculated field? Stu General Discussion 1 October 6th, 2004 10:26 PM
Display two different strings in Calculated Field based on rhe value in another field Adrian General Discussion 1 August 8th, 2004 08:42 PM
Problem with calculated controls with data from subforms Ragnar Midtskogen Using Forms 8 July 25th, 2004 07:18 PM
No Calculated Field Option in Excel 2002? David General Discussion 1 July 8th, 2004 11:58 PM


All times are GMT +1. The time now is 12:05 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.