Possilbe to supress a detail record.

  • Thread starter Thread starter REB
  • Start date Start date
R

REB

I have a report Detail section that looks like this:

__________________________

LastNameField FirstNamefield MiddleInitialField
Detail#1 about this person
Detail#2 about this person
Detail#3 about this person
Detail#4 about this person

______________________________________

If all 4 of the details about this person are blank(i.e the database fields
they are pulled from are NULL) is there a way to not show details for the
person at all without changing the query the report uses?

How would I do that?
 
You can use code in the On Format event of the detail section.
However, after reviewing your question, it isn't clear if the 4 details are
4 separate records or if they are 4 fields from a single record.
 
They are from 4 different records.

For example if my select query was:

Select lastname, firstname, middleinitial, detail1, detail2, detail3, detail
4
From mytable

In this scenario if detail1-4 all came back as NULL I would not want the
detail in the report to show anything.
 
You suggested they are from 4 different records and then proceeded to show
that it is 4 different fields.

Which is correct?
 
I just got my terminology all messed around. Usually as I type out what my
brain is telling me to I get things backwards and upside down.

My second example is what I am trying to explain. The details are fields
returned within each record.
 
Add code to the On Format event of the section. For instance if your text
boxes are named txt1 - txt4:
Me.Cancel = IsNull(Me.txt1) AND IsNull(Me.txt2) AND IsNull(Me.txt3) AND
IsNull(Me.txt4)
 
Thanks for the help. That looks like what I am trying to do, however,

..Cancel is not a choice in intellisense and when I entered the code like in
your example I received and error.

My version of Access is 2003 and the Version of Microsoft Visual Basic is
6.3

Here is what the code line looked like:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Cancel = IsNull(Me.DDataSheet) AND IsNull(Me.DRoadTest) AND
IsNull(Me.DPhysical)
End Sub

Intellisence found DDataSheet, DRoadTest, and DPhysical so I did not even
have to type them in, just had to pick them from the drop down list, but
Cancel was not a option.

Thanks again.
 
Excuse me, just use

Cancel = IsNull(Me.DDataSheet) AND IsNull(Me.DRoadTest) AND
IsNull(Me.DPhysical)
 
Back
Top