create field in query w/conditional statement

Posted on 2011-04-21
Last Modified: 2012-05-11
i have attached example db-
is there a way to add a field to qry1 -[newfield]
that has conditional statement that says:
if field 111 or 222 is checked then the newfield has 5 entered
and if field 333 or 444 is checked the newfield has 6 entered
thank you
Question by:davetough
    LVL 119

    Expert Comment

    by:Rey Obrero
    try this query

    SELECT tbl1.ID, tbl1.[item number], tbl1.[111], tbl1.[222], tbl1.[333], tbl1.[444], tbl1.[model number], IIf([111]=-1 Or [222]=-1,5,IIf([333]=-1 Or [444]=-1,6,0)) AS Expr1
    FROM tbl1;
    LVL 119

    Accepted Solution

    see query from sample file

    Author Closing Comment

    thank you - GREAT

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now