Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding a query 1

Status
Not open for further replies.

kupe

Technical User
Sep 23, 2002
376
I want to create this in the query that feeds a subform, frmMatrix.

If [DailyGrind] = "Dismissed" And [Sacked] = "Unsacked" Then [DailyGrind] = "Available"

Be most grateful for some guidance.
 
Have a look at the IIf function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Dear God, PHV,

I've looked at it at every possible angle (but the right one obviously) and I just don't see from my examples how I can bend the immediate if function round to suit this. If you can, I would be grateful indeed for your help.

Despairing of the Web
 
Perhaps this (in the query grid) ?
Available: IIf([DailyGrind]='Dismissed' And [Sacked]='Unsacked', 'Available', 'N/A')

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PH

You make it look so simple. I've suffered over this one. Very grateful indeed for your direction, and it looks as if for the answer as well. Thank you!
 
Hi PH

Works well, thank you.

Is it possible to say that if it doesn't meet the IIf criteria, leave the field reading as it presently does, please?

Would be good to use it in a combo box situation. Cheers.
 
you can put whatever you want in either of the true/false conditions...

e.g. iif(someLogicalTest, [fieldName], [fieldName] & [field2Name])

or whatever you want to (concoct, conqoct... eh... ) make up...

--------------------
Procrastinate Now!
 
Simply this ?
Available: IIf([DailyGrind]='Dismissed' And [Sacked]='Unsacked', 'Available', [DailyGrind])

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, Crowley16, but can you have it so that the existing entry remains if the true condition is NOT met, please?
 
Hi PH
And putting the field in square brackets like that means don't change it if the true condition is not met, please?
 
No. The answer is 'no', drat.

I'm trying to apply the function to the field DailyGrind, so that if the criteria is met, it will show "Available".

But if the situation is false, it will just show what it currently displays.

It won't work of course using the field's name, and with an alias, it won't let the combo box choices work. Presumably because this is a subform, I simply cannot get your common or garden If Then Else to work.

Mystified of Warwickshire (and somewhat Frustrated).

PS But I am able to use that immediate if and remain Most Grateful. Thanks, PH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top