user3207038
user3207038

Reputation: 1

How to show only "filled in" fields on an Access report

I have created a report for Microsoft access and am trying to add fields to a report only if then have been clicked on our filled out. The only way I can think of doing this is writing a code or an if-then statement in access. I have very little experience with writing code and am not sure where to begin. I'm looking for something like "If a checkbox is selected then add it to the report".

Thank you.

Upvotes: 0

Views: 5891

Answers (3)

LMM
LMM

Reputation: 1

This is really old, but I had the same issue above, but found a easy solution.

  • Go to Design view in your "report"
  • Make your Yes/No boxes not visible
  • Go to the Design tab in your tool bar
  • Click on the Controls and click on the Check box and place them over your Yes/No box
  • Delete the label it gives with the check box
  • Save and look at your report
  • Only the YES will appear as a checked box.

Upvotes: 0

Gord Thompson
Gord Thompson

Reputation: 123689

Instead of trying to dynamically add controls to a report you could include all of the fields on the report and then simply hide the controls that correspond to empty fields. For example, if you have a text field named [SpecialRequirements] and your report contains a bound text box named [txtSpecialRequirements] then in the On Format event handler of the report's Detail band you could use

Me.txtSpecialRequirements.Visible = (Not IsNull([SpecialRequirements]))

which is just a shorthand way of saying

If IsNull([SpecialRequirements]) Then
    Me.txtSpecialRequirements.Visible = False
Else
    Me.txtSpecialRequirements.Visible = True
End If

Upvotes: 3

Katana24
Katana24

Reputation: 8959

This should get you started - its a basic if structure:

If Me!myCheckBox = True Then
     'Write to the report
Else
     'Do something else
End If

Also check out the Microsoft Developer Network here for information on the If...Then..Else statement

Upvotes: 0

Related Questions