General discussion

Locked

MS-Access

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

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

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.

Collapse -

by pina In reply to

Poster rated this answer.

Collapse -

by sgt_shultz In reply to MS-Access

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

Collapse -

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.

Collapse -

by pina In reply to

Poster rated this answer.

Back to Software Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums