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!

how to supress blank lines on a report with photo and txt fields? 1

Status
Not open for further replies.

Werneck

Technical User
Aug 5, 2003
36
BR
need a report with employee text fields stacked on the right side of a photo field.

some text fields of a record might be empty and the blank line(s) should not appear, instead the next text field(s) data should occupy the empty lines.

although I used the proper detail session properties of the report, the empty field line(s) show up.

If I delete the photo field or stack it above the stacked text fields, then all works fine either on Access 97 or 2002.

does anybody has a solution for this?
 
What I do in this situation is to have a TextBox bound to each of the fields but set their visible property to False and stack them on top of one another.. then I create one Unbound textbox to put all of the data in (each on a separate line). I set the Can Grow and Can Shrink properties of this TextBox and the Detail Section to "Yes". I use the Detail's On Format Event to check the values in each of the bound TextBoxes and create a variable based on the results, then set the Unbound TextBox equal to the variable, as in the following example

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strData As String
strData = ""
'Each Record Must Have A Name
If Len(Nz(txtNAME)) > 0 Then
strData = txtNAME
End If
'Check For Group Data
If Len(Nz(txtGROUP)) > 0 Then
strData = strData & vbCrLf & txtGROUP
End If
'Check For Title Data
If Len(Nz(txtTITLE)) > 0 Then
strData = strData & vbCrLf & txtTITLE
End If
'Check For Phone Data
If Len(Nz(txtPHONE)) > 0 Then
strData = strData & vbCrLf & txtPHONE
End If
'Check for Location Data
If Len(Nz(txtLOCATION)) > 0 Then
strData = strData & vbCrLf & txtLOCATION
End If
'Check For Email Address
If Len(Nz(txtEmail)) > 0 Then
strData = strData & vbCrLf & txtEmail
End If
'Set the Unbound TextBox Equal to the Variable
txtData = strData

End Sub

HTH
PaulF
 
than you PaulF for this nice solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top