Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to Exclude a Field on a Report if Field is Blank

Status
Not open for further replies.

JSD

Technical User
Jan 18, 2002
189
US
I have five fields I'm printing on a report. One of those fields is a 'Notes' field. The notes are in the detail section. I want the field and text label excluded from the report if it is blank. I was already recommended some code to put in the OnFormat property in the detail section of the report, but I get an error message when I try to open the report.

The error message is:

Run-time error '424':
Object required

And it gives the option to debug, highlighting the second line of code in yellow:

If Len(Trim(Nz(txtNotes, ""))) = 0 Then
txtNotes.Visible = False
lblNotes.Visible = False
Else
txtNotes.Visible = True
lblNotes.Visible = True
End If

Any trobleshootg ideas? Another way?
 
Hi

If Len(Trim(Nz(txtNotes, ""))) = 0 Then
txtNotes.Visible = False
lblNotes.Visible = False
Else
txtNotes.Visible = True
lblNotes.Visible = True
End If

The fact that it does not stop on the first line, implies that it does not object to txtNotes in itself, but only the use of the visible proeprty in relation to txtNotes, so

txtNotes is the name of the notes column in the detail section of the report?

and/or

do you have a variable called txtNotes in scope in the detail section, on format event, ie Dim'd theer of Dim'd as a global



Hope this helps

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reaySPAMNOT@talk21.com
remove SPAMNOT to use
 
Hello.

Thanks, it works!!!!!
All I had to do was change the name to 'Notes' and 'Labe16' for the caption.

Your time and expertise is much appreciated.

Jeremy
Cleveland, Oh
USA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top