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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select not empty fields to show in report on Report open

Status
Not open for further replies.

cP6uH

Programmer
May 21, 2003
17
0
0
CA
I have a report that has a query with around 30 fileds.
I need to check 15 of those 30 fields to see if they're empty, and if they're not I want to put them in the string, and print them on the report.
I know I can do it if i go field by field, and check if it's empty, and if it's not, add it to the string, but that would take too much writing to do, and also I'd have to put textboxes on the form, and just make them invisible.

There has to be a faster way to do this with a loop of some sort.

Can someone help me with this ??

Just to show the way I know how to do it:


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If Not IsNull(Me.field1) Then
strStuff = strStuff & " " & Me.field1
End If
.
.
.
and so on for all 15 fields....


End Sub
 
Dim i as integer

For i=1 to strStuff.Count
If Not IsNull(Me.field1) Then
strStuff = strStuff & " " & Me.field1
End If
Next

It would help to know if Report is in Excel, Access, Crystal etc

TIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top