report if/then

awake2424

Registered User.
Local time
Today, 11:09
Joined
Oct 31, 2007
Messages
479
Is it possible to have a report show text if a field is filled out in a table.

For example:

Table:
Name: Bob Jones Sam Smith
Age:55
Address:1212 Acorn Lane 1322 Turner Ave


Report:
Name:Bob Jones Sam Smith
Address: 1212 Acorn Lane 1322 Turner Ave
Age:55

I would like the report to only print Age if it is filled out in the table. Thanks.
 
Put this code in the Detail OnFormat section of the report


Code:
Dim ctl As Control
For Each ctl In Me.Controls
    If ctl.ControlType = acTextBox And IsNull(ctl) Then
       ctl.Visible = False
     Else
       ctl.Visible = True
     End If
Next ctl
Set ctl = Nothing

I hope this help you.
 

Users who are viewing this thread

Back
Top Bottom