General discussion

  • Creator
    Topic
  • #2298107

    MS-Access

    Locked

    by pina ·

    How do I program a field to print-out on a report only if another field is not empty

All Comments

  • Author
    Replies
    • #2742819

      Reply To: MS-Access

      by jennifer.gardner ·

      In reply to MS-Access

      Create a query to sort out the records you want to display. Then create your report from your query. If your query only shows records with a value in a certain field, then those are the only records that will show on the report.

      • #2742607

        Reply To: MS-Access

        by pina ·

        In reply to Reply To: MS-Access

        Poster rated this answer.

    • #2742794

      Reply To: MS-Access

      by sgt_shultz ·

      In reply to MS-Access

      well, gotta define ’empty’. what’s in a blank field depends. check out IS NULL function…

    • #2744329

      Reply To: MS-Access

      by it_cowboy ·

      In reply to MS-Access

      In a query that will provide the data for the report, create a new field. The new field will contain a formula that will check the first field for content, then if there is information in it will return the value from the second field, otherwise it will be blank.
      To create a field in a query, enter a name (without spaces is easiest) followed by a colon. For this example, the new field will be called “Result”. Replace “First Field” with the field name containing the data you want to check for. Replace “Second Field” with the name of the field that you want to show if first field contains data.
      Result: Iif(Len(Trim(Nz(“First Field”,””)))=0,Null,”Second Field”)
      The function checks the length of the first field (after returning a zero length string if the value is null (Nz function) and has had all leading and trailing blanks removed (Trim function). If the length is zero, the Results field will contain nothing. If first field contains informaiton, then the value in the second field will displayed in the Results field.

      • #2742022

        Reply To: MS-Access

        by pina ·

        In reply to Reply To: MS-Access

        Poster rated this answer.

Viewing 2 reply threads