0
votes

I am trying to use a report to print out a list of users with their name and unique id. The kicker to the database I am using is that there is a field that "active" that denotes whether or not that user is still actively using the service. For cases when a user is not active, I want to omit them from the report.

So far I have tried setting the values of the fields equal to Null when the flag is encountered, but this leaves white space behind which makes the form look sparse and wastes space.

I have also tried setting the appropriate Visible field to False in VBA, but so far I am only able to make either columns or the whole report disappear. Is there any way to make it so that a row that represents a single user entry is not visible?

Here is the VBA code I have for this, fairly simple, I just need to figure out the right item to place in the line that says 'Hide Row

Note: [Active] links to the hidden data field on the form that links to my table telling whether or not the user is an active one

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If [Active] = False Then
    'Hide Row
End If

End Sub

Thanks in advance!

-dbriggs

1

1 Answers

3
votes

Forms are not the best thing for output. Create a query that excludes the relevant rows and use it to create a report.

It is also possible to create a report based on all records and use a where statement with OpenReport

DoCmd.OpenReport "ReportName", acViewPreview, , "Active=True"