• Eliminate some fields but not record in report

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Eliminate some fields but not record in report

    Author
    Topic
    #477028

    Would like to list all records but if a boolean field is true not show certain fields such as address, city, state, zip. I can barely get started with this for this is what I have:

    SELECT Lastname, Firstname, NoAddress, Address, City, State, Zip
    FROM Members
    WHERE IIF(NoAddress,”, ”)
    ORDER BY Lastname

    NoAddress is the boolean.

    Viewing 1 reply thread
    Author
    Replies
    • #1281953

      First, are you doing this in Access or SQL Server? If it is Access, the simplest way to do this is a series of IIF() expressions that check the status of the boolean field. If it is true, then you can display either a Null value, or an empty text string (“”). If it is SQL Server, TSQL makes this a fair bit more complicated, as you have to use CASE statements. Hope this helps – if you want more advice on the syntax, post back and I’m sure someone can assist you.

    • #1281972

      Thanks for the reply. The light just went on with your suggestion. I was trying to do it with only one conditional statement and in the WHERE portion of the SELECT statement. It has to be with each field that is affected.

    Viewing 1 reply thread
    Reply To: Reply #1281972 in Eliminate some fields but not record in report

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel